Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@justinribeiro/barcode-reader

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@justinribeiro/barcode-reader

A web component that uses the Shape Detection API and module scripts in DedicatedWorker to detect barcodes.

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

npm version

<barcode-reader>

A web component that reads barcodes via the Shape Detection API via a Web Worker.

screenshot of barcode-reader

Features

Experimental

Please note, this is not production ready. It's not polyfilled, it relies on an experimental platform feature for the Web Worker, and generally I've just been toying with it in various Chrome builds for quite some time.

Use at your own peril! 🐉🔥

A more complete example

If you're looking for a more complete PWA example of using barcodes on the web, I highly recommend Paul Kinlans' QR Snapper as well as his blog.

Install

This web component is built with Polymer 3 and ES modules in mind and is available on NPM:

Install barcode-reader:

npm i @justinribeiro/barcode-reader
# or
yarn add @justinribeiro/barcode-reader

After install, import into your project:

import 'barcode-reader';

Finally, use as required:

<barcode-reader></barcode-reader>
<script>
  customElements.whenDefined('barcode-reader').then(() => {
    const barcodeReader = document.querySelector('barcode-reader');

    // start the camera stream
    // always looks for
    // facingMode: {
    //   exact: 'environment',
    // }
    barcodeReader.start();

    // component returns a custom event with results
    document.addEventListener('barcodes-found', (event) => {
      console.log(event.detail.barcodes);

      // if you want to stop streaming, ala, I'm hiding you now
      barcodeReader.stop();
    }, false);
  });
</script>

Keywords

FAQs

Package last updated on 03 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc