Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
yushulx committed Aug 5, 2024
1 parent 5641e8a commit 37683b5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
31 changes: 13 additions & 18 deletions src/app/product-list/product-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { SharedService } from '../shared.service';
import 'dynamsoft-document-normalizer';
import 'dynamsoft-label-recognizer';
import 'dynamsoft-code-parser';
import { getFullUrl } from '../utils';

@Component({
selector: 'app-product-list',
Expand All @@ -20,33 +21,27 @@ export class ProductListComponent {
inputText: string = '';
processedText: string = '';
placeholderText: string = 'DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAxLTE2NDk4Mjk3OTI2MzUiLCJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInNlc3Npb25QYXNzd29yZCI6IndTcGR6Vm05WDJrcEQ5YUoifQ==';
private baseUrl: string;

constructor(private sharedService: SharedService) {
this.baseUrl = `${window.location.protocol}//${window.location.host}${window.location.pathname}`;
}

getFullUrl(endpoint: string): string {
return `${this.baseUrl}${endpoint}`;
}

async activate(): Promise<void> {

this.processedText = this.inputText.toUpperCase();
// Configure the paths where the .wasm files and other necessary resources for modules are located.
CoreModule.engineResourcePaths = {
std: this.getFullUrl('assets/dynamsoft-capture-vision-std/'),
dip: this.getFullUrl('assets/dynamsoft-image-processing/'),
core: this.getFullUrl('assets/dynamsoft-core/'),
license: this.getFullUrl('assets/dynamsoft-license/'),
cvr: this.getFullUrl('assets/dynamsoft-capture-vision-router/'),
dbr: this.getFullUrl('assets/dynamsoft-barcode-reader/'),
dce: this.getFullUrl('assets/dynamsoft-camera-enhancer/'),
ddn: this.getFullUrl('assets/dynamsoft-document-normalizer/'),
dlr: this.getFullUrl('assets/dynamsoft-label-recognizer/'),
dcp: this.getFullUrl('assets/dynamsoft-code-parser/'),
dnn: this.getFullUrl('assets/dynamsoft-capture-vision-dnn/'),
dlrData: this.getFullUrl('assets/dynamsoft-label-recognizer-data/'),
std: getFullUrl('assets/dynamsoft-capture-vision-std/'),
dip: getFullUrl('assets/dynamsoft-image-processing/'),
core: getFullUrl('assets/dynamsoft-core/'),
license: getFullUrl('assets/dynamsoft-license/'),
cvr: getFullUrl('assets/dynamsoft-capture-vision-router/'),
dbr: getFullUrl('assets/dynamsoft-barcode-reader/'),
dce: getFullUrl('assets/dynamsoft-camera-enhancer/'),
ddn: getFullUrl('assets/dynamsoft-document-normalizer/'),
dlr: getFullUrl('assets/dynamsoft-label-recognizer/'),
dcp: getFullUrl('assets/dynamsoft-code-parser/'),
dnn: getFullUrl('assets/dynamsoft-capture-vision-dnn/'),
dlrData: getFullUrl('assets/dynamsoft-label-recognizer-data/'),
};

try {
Expand Down
5 changes: 5 additions & 0 deletions src/app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,9 @@ export function handleMrzParseResult(result: ParsedResultItem): any {
}
parseResultInfo["Date of Expiry (YYYY-MM-DD)"] = expiryYear + "-" + expiryMonth + "-" + expiryDay;
return parseResultInfo;
}

export function getFullUrl(endpoint: string): string {
let baseUrl = `${window.location.protocol}//${window.location.host}${window.location.pathname}`;
return `${baseUrl}${endpoint}`;
}

0 comments on commit 37683b5

Please sign in to comment.