UNPKG

@scandit/web-datacapture-barcode

Version:

Scandit Data Capture SDK for the Web

4 lines (2 loc) 1.54 kB
var i=class{constructor(e,r,t){this.captureListenerSet=!1;this.coreEngine=e,this.Module=r,this.workerFunctions=t,this.setup();}barcodeCaptureDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeCaptureDidUpdateSession",payload:JSON.parse(e.toJson())});}barcodeBatchDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeBatchDidUpdateSession",payload:JSON.parse(e.toJson())});}getCaptureDeserializer(){return this.barcodeCaptureDeserializer}getTrackingDeserializer(){return this.barcodeBatchDeserializer}setup(){let e=this.Module.BarcodeCaptureListener.extend("BarcodeCaptureListener",{didScan:(s,a,d)=>{this.barcodeCaptureDidScan(a,d);},didUpdateSession:(s,a)=>{this.barcodeCaptureDidUpdateSession(a);}}),r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback();}}),t=new e,o=new r,n=this.Module.BarcodeCaptureDeserializerListener.extend("BarcodeCaptureDeserializerListener",{onModeDeserializationFinished:(s,a)=>{a.addListener(t,1),a.setSuccessFeedback(o);},onModeDeserializationStarted(){},onSettingsDeserializationStarted(){},onSettingsDeserializationFinished(){}});this.barcodeCaptureDeserializer=new this.Module.BarcodeCaptureDeserializer,this.barcodeCaptureDeserializer.setListener(new n);}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"});}barcodeCaptureDidScan(e,r){let t=this.coreEngine.convertToLoadableFrameData(r);this.workerFunctions.postMessage({type:"barcodeCaptureDidScan",payload:{session:JSON.parse(e.toJson()),frameData:t}});}}; export { i as a };