How to use the @zxing/library.ArgumentException 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 zxing-js / ngx-scanner / projects / zxing-scanner / src / lib / zxing-scanner.component.ts View on Github external
set device(device: MediaDeviceInfo | null) {

    if (!device && device !== null) {
      throw new ArgumentException('The `device` must be a valid MediaDeviceInfo or null.');
    }

    if (this.isCurrentDevice(device)) {
      console.warn('Setting the same device is not allowed.');
      return;
    }

    if (this.isAutostarting) {
      // do not allow setting devices during auto-start, since it will set one and emit it.
      console.warn('Avoid setting a device during auto-start.');
      return;
    }

    if (!this.hasPermission) {
      console.warn('Permissions not set yet, waiting for them to be set to apply device change.');
      // this.permissionResponse
github zxing-js / ngx-scanner / projects / zxing-scanner / src / lib / zxing-scanner.component.ts View on Github external
set device(device: MediaDeviceInfo | null) {

    if (this.isAlreadyDefinedDevice(device)) {
      return;
    }

    // in order to change the device the codeReader gotta be reseted
    this.scannerStop();

    if (!device && device !== null) {
      throw new ArgumentException('The `device` must be a valid MediaDeviceInfo or null.');
    }

    if (!!device) {
      // starts if enabled and set the current device
      this.startScan(device);
    }
  }