How to use qrloop - 8 common examples

To help you get started, we’ve selected a few qrloop 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 LedgerHQ / ledger-live-common / cli / src / commands.js View on Github external
mergeMap(accounts => {
          const data = encode({
            accounts,
            settings: {
              pairExchanges: {},
              currenciesSettings: {}
            },
            exporterName: "ledger-live-cli",
            exporterVersion: "0.0.0"
          });
          const frames = dataToFrames(data, 80, 4);

          if (opts.out) {
            return of(Buffer.from(JSON.stringify(frames)).toString("base64"));
          } else {
            const qrObservables = frames.map(str =>
              asQR(str).pipe(shareReplay())
            );
            return interval(300).pipe(
              mergeMap(i => qrObservables[i % qrObservables.length])
            );
          }
        }),
        tap(() => console.clear()) // eslint-disable-line no-console
github LedgerHQ / ledger-live-desktop / src / components / Exporter / QRCodeExporter.js View on Github external
constructor(props) {
    super()
    const { accounts, settings } = props
    const data = encode({
      accounts,
      settings,
      exporterName: 'desktop',
      exporterVersion: __APP_VERSION__,
    })

    this.chunks = dataToFrames(data, 160, 4)

    setTimeout(() => {
      const BRIDGESTREAM_DATA = Buffer.from(JSON.stringify(this.chunks)).toString('base64')
      console.log(`BRIDGESTREAM_DATA=${BRIDGESTREAM_DATA}`) // eslint-disable-line
    }, 500)
  }
github LedgerHQ / ledger-live-mobile / src / screens / ImportAccounts / Scan.js View on Github external
onBarCodeRead = ({ data }: { data: string }) => {
    if (data && data !== this.lastData && !this.completed) {
      this.lastData = data;
      try {
        this.frames = parseFramesReducer(this.frames, data);

        this.setState({ progress: progressOfFrames(this.frames) });

        if (areFramesComplete(this.frames)) {
          try {
            this.onResult(decode(framesToData(this.frames).toString()));
            this.completed = true;
          } catch (error) {
            this.frames = null;
            this.setState({ error, progress: 0 });
          }
        }
      } catch (e) {
        console.warn(e);
      }
    }
  };
github LedgerHQ / ledger-live-mobile / src / screens / ImportAccounts / Scan.js View on Github external
onBarCodeRead = ({ data }: { data: string }) => {
    if (data && data !== this.lastData && !this.completed) {
      this.lastData = data;
      try {
        this.frames = parseFramesReducer(this.frames, data);

        this.setState({ progress: progressOfFrames(this.frames) });

        if (areFramesComplete(this.frames)) {
          try {
            this.onResult(decode(framesToData(this.frames).toString()));
            this.completed = true;
          } catch (error) {
            this.frames = null;
            this.setState({ error, progress: 0 });
          }
        }
      } catch (e) {
        console.warn(e);
      }
    }
  };
github LedgerHQ / ledger-live-mobile / src / screens / ImportAccounts / Scan.js View on Github external
onBarCodeRead = ({ data }: { data: string }) => {
    if (data && data !== this.lastData && !this.completed) {
      this.lastData = data;
      try {
        this.frames = parseFramesReducer(this.frames, data);

        this.setState({ progress: progressOfFrames(this.frames) });

        if (areFramesComplete(this.frames)) {
          try {
            this.onResult(decode(framesToData(this.frames).toString()));
            this.completed = true;
          } catch (error) {
            this.frames = null;
            this.setState({ error, progress: 0 });
          }
        }
      } catch (e) {
        console.warn(e);
      }
    }
github LedgerHQ / ledger-live-mobile / src / screens / ImportAccounts / Scan.js View on Github external
onBarCodeRead = ({ data }: { data: string }) => {
    if (data && data !== this.lastData && !this.completed) {
      this.lastData = data;
      try {
        this.frames = parseFramesReducer(this.frames, data);

        this.setState({ progress: progressOfFrames(this.frames) });

        if (areFramesComplete(this.frames)) {
          try {
            this.onResult(decode(framesToData(this.frames).toString()));
            this.completed = true;
          } catch (error) {
            this.frames = null;
            this.setState({ error, progress: 0 });
          }
        }
      } catch (e) {
        console.warn(e);
      }
    }
  };
github LedgerHQ / ledger-live-mobile / src / screens / ImportAccounts / Scan.js View on Github external
componentDidMount() {
    const { navigation } = this.props;
    const data = navigation.getParam("data");
    if (data) {
      const frames = data.reduce(parseFramesReducer, null);
      if (areFramesComplete(frames)) {
        this.onResult(decode(framesToData(frames).toString()));
      }
    }
  }
github LedgerHQ / ledger-live-mobile / src / screens / ImportAccounts / Scan.js View on Github external
componentDidMount() {
    const { navigation } = this.props;
    const data = navigation.getParam("data");
    if (data) {
      const frames = data.reduce(parseFramesReducer, null);
      if (areFramesComplete(frames)) {
        this.onResult(decode(framesToData(frames).toString()));
      }
    }
  }

qrloop

Envelop big blob of data into frames that can be displayed in series of QR Codes

MIT
Latest version published 2 years ago

Package Health Score

48 / 100
Full package analysis