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

scannqr

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scannqr

Customisable javascript video scanner with the ability to scan QR codes

  • 1.1.5
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

Scannqr

Customisable javascript video stream QR Code scanner

🚀 Features

  • Scan camera video stream for QRCodes using the jsQR QR code reading library.
  • Animated UI with QR code detection outline
  • Customisable using the options object when creating scanner
  • Option to pass in input to output QR Code result and to submit form

📦 Getting Started

Installation
npm install scannqr
JS Module
// ES6 import
import {QRScanner} from "/your-path-to-scanner/dist/scannqr.js";

// CommonJS require
const {QRScanner} = require("/your-path-to-scanner/dist/scannqr.js");
HTML Script tag
<script src="/your-path-to-scannqr/dist/scannqr.js"></script>

🔨 Usage

  1. Create HTML
    <form class="qrscanner__wrapper">
        <button class="qrscanner__startBtn" type="button">Scan</button>
        <input class="qrscanner__input"/>
        <button class="qrscanner__submitBtn">Submit</button>
    </form>
</div>
  1. Import CSS
    <link rel="stylesheet" href="/your-path-to-scannqr/dist/css/scannqr.css"/>
  1. Create Scanner Instance
const qrscanner = new QRScanner({
    wrapper: document.querySelector('.qrscanner__wrapper'),
    startBtn: document.querySelector('.qrscanner__startBtn'),
    output: document.querySelector('.qrscanner__input'),
    submitBtn: document.querySelector('.qrscanner__submitBtn'),
    //See list of all possible options below
});

⚙️Options

Required

wrapper

Type: HTMLElement

Element to append scanner

startElement

Type: HTMLElement

Element to commence scanning and calculate starting position

Optional

output

Type: String

Input element to output QR code message

submitBtn

Type: String

Submit button to click on successful QR code extraction

backBtnHTML

Type: string
Default:Go Back

HTML used for scanner background prior/instead of video display

handleSuccess

Type: Function

Default:

function() {
    await this.outlineQRCode();
    await this.stop();
    if (this.output) this.output.value = this.QRCode.data;
    if (this.submitBtn) this.submitBtn.click();
}

Customisable callback for successful QR code detection - default outlines QR code, populates input and submits form

primaryColor

Type: String
Default: #03a803

Primary color used for scanner e.g. used to draw on canvas

Keywords

FAQs

Package last updated on 28 Jun 2023

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