0

I use LWC Barcode Scanner API try to develop continuous scan feature. LWC Barcode Scanner API document as follow link: https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.use_barcodescanner

My code for continuous scan as follow

     for (let index = 0; index < this.maxContinuousScanCount; index++) {
        this.scanner.beginCapture(options).then((result) => {
            var value = decodeURIComponent(result.value);
            this.scanResults.push([value]);
            setTimeout(() => {
                this.handleContinuousScanEachTime(value);
                this.playSound(true);
            });
        }).catch((error) => {
            setTimeout(() => {
                this.playSound(false);
                this.showFailedToast(error);
            });
            this.scanner.endCapture();
        }).finally(() => {
            this.scannerResult = this.scanResults.join('\n\r');                
        });            
    }
    this.scanner.endCapture();

Is this code issue or just LWC Barcode Scanner API not support continuous scan yet?

Best wishes, Lee

1
  • I think you need to consider promises.all() for the current implementation. Since you're pushing multiple promises in loop and want them to be in sync manner, I feel that's the best option you can have. freecodecamp.org/news/…
    – Ysr Shk
    Commented Sep 16, 2020 at 3:29

1 Answer 1

0

Not found useful idea about it. Please need check this in next Release.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .