How to use the @zxing/library.BrowserBarcodeReader function in @zxing/library

To help you get started, we’ve selected a few @zxing/library examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github metasfresh / metasfresh-webui-frontend / src / components / widget / BarcodeScanner / BarcodeScanner.js View on Github external
constructor(props) {
    super(props);

    const barcodeScannerType = props.barcodeScannerType
      ? props.barcodeScannerType
      : 'qrCode';

    this.state = {
      barcodeScannerType: barcodeScannerType,
    };

    if (barcodeScannerType == 'qrCode') {
      this.reader = new BrowserQRCodeReader();
    } else if (barcodeScannerType == 'barcode') {
      this.reader = new BrowserBarcodeReader();
    } else if (barcodeScannerType == 'datamatrix') {
      this.reader = new BrowserDatamatrixCodeReader();
    } else {
      throw new Error('Unknown barcodeScannerType: ' + barcodeScannerType);
    }
  }
github metasfresh / metasfresh-webui-frontend / src / components / widget / BarcodeScanner / BarcodeScanner.js View on Github external
_changeReader = () => {
    const { barcodeScannerType } = this.state;

    this.reader.stopStreams();

    if (barcodeScannerType == 'qrCode') {
      this.reader = new BrowserBarcodeReader();
      this.props.onClose(true);
      this.setState(
        {
          barcodeScannerType: 'barcode',
        },
        () => this._process()
      );
    }
  };