UNPKG

dynamsoft-barcode-reader-bundle

Version:

Dynamsoft Barcode Reader JS is a recognition SDK which enables you to embed barcode reading functionality in your web, desktop, and mobile applications. With a few lines of JavaScript code, you can develop a robust application to scan a linear barcode, QR

6 lines 1.96 kB
/** * @license * Copyright 2015 The Emscripten Authors * SPDX-License-Identifier: MIT */ "use strict";var Module={},initializedJS=!1;function threadPrintErr(){var e=Array.prototype.slice.call(arguments).join(" ");console.error(e)}function threadAlert(){var e=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:e,threadId:Module._pthread_self()})}var err=threadPrintErr;function handleMessage(e){try{if("load"===e.data.cmd){let t=[];self.onmessage=e=>t.push(e),self.startWorker=e=>{postMessage({cmd:"loaded"});for(let e of t)handleMessage(e);self.onmessage=handleMessage},Module.wasmModule=e.data.wasmModule;for(const a of e.data.handlers)Module[a]=(...e)=>{postMessage({cmd:"callHandler",handler:a,args:e})};if(Module.wasmMemory=e.data.wasmMemory,Module.buffer=Module.wasmMemory.buffer,Module.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof e.data.urlOrBlob)importScripts(e.data.urlOrBlob);else{var a=URL.createObjectURL(e.data.urlOrBlob);importScripts(a),URL.revokeObjectURL(a)}}else if("run"===e.data.cmd){Module.__emscripten_thread_init(e.data.pthread_ptr,0,0,1),Module.__emscripten_thread_mailbox_await(e.data.pthread_ptr),Module.establishStackSpace(),Module.PThread.receiveObjectTransfer(e.data),Module.PThread.threadInitTLS(),initializedJS||(initializedJS=!0);try{Module.invokeEntryPoint(e.data.start_routine,e.data.arg)}catch(e){if("unwind"!=e)throw e}}else"cancel"===e.data.cmd?Module._pthread_self()&&Module.__emscripten_thread_exit(-1):"setimmediate"===e.data.target||("checkMailbox"===e.data.cmd?initializedJS&&Module.checkMailbox():e.data.cmd&&(err(`worker.js received unknown command ${e.data.cmd}`),err(e.data)))}catch(e){throw Module.__emscripten_thread_crashed&&Module.__emscripten_thread_crashed(),e}}self.alert=threadAlert,Module.instantiateWasm=(e,a)=>{var t=Module.wasmModule;return Module.wasmModule=null,a(new WebAssembly.Instance(t,e))},self.onunhandledrejection=e=>{throw e.reason||e},self.onmessage=handleMessage;