mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Polyfill BarcodeDetector API for improved performance of Html5QRcodeScanner
This commit is contained in:
parent
9e85b70c17
commit
4b09a321ad
4 changed files with 54 additions and 1 deletions
|
@ -44,4 +44,21 @@ import "./register_events";
|
|||
import "./tristate_checkboxes";
|
||||
|
||||
//Define jquery globally
|
||||
window.$ = window.jQuery = require("jquery")
|
||||
window.$ = window.jQuery = require("jquery");
|
||||
|
||||
//Use the local WASM file for the ZXing library
|
||||
import {
|
||||
setZXingModuleOverrides,
|
||||
} from "barcode-detector/pure";
|
||||
import wasmFile from "../../node_modules/zxing-wasm/dist/reader/zxing_reader.wasm";
|
||||
|
||||
setZXingModuleOverrides({
|
||||
locateFile: (path, prefix) => {
|
||||
if (path.endsWith(".wasm")) {
|
||||
return wasmFile;
|
||||
}
|
||||
return prefix + path;
|
||||
},
|
||||
});
|
||||
//Enable polyfill for the barcode detector. The WASM triggering is done when the barcode detector is used
|
||||
import "barcode-detector/side-effects";
|
Loading…
Add table
Add a link
Reference in a new issue