@authme/engine 2.2.1-rc.5 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/engine-worker.js +24 -7
- package/assets/ml_engine_web.js +1 -1
- package/assets/ml_engine_web.simd.js +1 -1
- package/assets/ml_engine_web.simd.wasm +0 -0
- package/assets/ml_engine_web.wasm +0 -0
- package/assets/ml_engine_web_version.txt +1 -1
- package/index.cjs +10 -2
- package/index.js +10 -2
- package/package.json +3 -3
- package/src/lib/engine.d.ts +2 -5
- package/src/lib/enum/id-recognition.enum.d.ts +3 -1
- package/src/lib/interface/basic-type.interface.d.ts +10 -0
package/assets/engine-worker.js
CHANGED
|
@@ -292,6 +292,9 @@
|
|
|
292
292
|
positions[3][1]
|
|
293
293
|
);
|
|
294
294
|
},
|
|
295
|
+
getFinalResult() {
|
|
296
|
+
return this.instance.getFinalResult();
|
|
297
|
+
},
|
|
295
298
|
};
|
|
296
299
|
|
|
297
300
|
// Card OCR
|
|
@@ -506,18 +509,32 @@
|
|
|
506
509
|
addEventListener(
|
|
507
510
|
'message',
|
|
508
511
|
async function onWorkerMessage({ data }) {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
512
|
+
try {
|
|
513
|
+
const { module, command, id, value } = data;
|
|
514
|
+
const fn = self[module][command];
|
|
515
|
+
if (fn) {
|
|
516
|
+
// console.log(`call ${module}.${command} :`, value);
|
|
517
|
+
const result = await fn.call(self[module], value);
|
|
518
|
+
// console.log(`worker return value for ${command}:`, result);
|
|
519
|
+
postMessage({
|
|
520
|
+
module,
|
|
521
|
+
command,
|
|
522
|
+
id,
|
|
523
|
+
value: result,
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
} catch (error) {
|
|
527
|
+
const { module, command, id } = data;
|
|
515
528
|
postMessage({
|
|
516
529
|
module,
|
|
517
530
|
command,
|
|
518
531
|
id,
|
|
519
|
-
value:
|
|
532
|
+
value: {
|
|
533
|
+
error: true,
|
|
534
|
+
cause: error,
|
|
535
|
+
},
|
|
520
536
|
});
|
|
537
|
+
throw error;
|
|
521
538
|
}
|
|
522
539
|
}.bind(self)
|
|
523
540
|
);
|