JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 35
  • Score
    100M100P100Q107342F
  • License SEE LICENSE IN LICENSE

The Scandit Web Barcode Link package

Package Exports

  • @scandit/web-barcode-link

Readme

@scandit/web-barcode-link

Scandit's Barcode Link SDK enables seamless barcode scanning between a desktop and a mobile device.

Installation

npm install @scandit/web-barcode-link

Quick Start

import { BarcodeLink, BarcodeLinkMode } from "@scandit/web-barcode-link";

const barcodeLink = BarcodeLink.forLicenseKey("YOUR_LICENSE_KEY")
    .setBarcodeLinkMode(BarcodeLinkMode.SingleScanning)
    .addListener({
        onCapture(barcodes, finished) {
            console.log("Scanned:", barcodes);
        },
    });

await barcodeLink.initialize();

API

Main class for barcode scanning functionality.

import { BarcodeLink } from "@scandit/web-barcode-link";

const barcodeLink = BarcodeLink.forLicenseKey("YOUR_LICENSE_KEY")
    .setSymbologies({
        /* symbology settings */
    })
    .setBarcodeRegexValidation(/pattern/)
    .setPlatform(BarcodeLinkPlatform.Web)
    .setListBehavior(BarcodeLinkListBehavior.Unique)
    .addListener({
        onCapture(barcodes, finished) {
            /* ... */
        },
        onCancel() {
            /* ... */
        }, // Only available in the ui flow
        onConnectionStateChanged(connectionState) {
            /* ... */
        } // Only available in the uiless flow
    });

BarcodeLinkMode

Controls how scanning behaves.

import { BarcodeLinkMode } from "@scandit/web-barcode-link";

barcodeLink.setBarcodeLinkMode(BarcodeLinkMode.SingleScanning);

// Available modes:
BarcodeLinkMode.SingleScanning; // Scan a single barcode and finish
BarcodeLinkMode.ContinuousScanning; // Continuously scan barcodes
BarcodeLinkMode.SingleListBuilding; // Build a list of barcodes and finish
BarcodeLinkMode.ContinuousListBuilding; // Continuously build lists of barcodes

BarcodeLinkListBehavior

Controls how barcodes are collected when using list building modes.

import { BarcodeLinkListBehavior } from "@scandit/web-barcode-link";

barcodeLink.setListBehavior(BarcodeLinkListBehavior.Unique);

// Available behaviors:
BarcodeLinkListBehavior.Unique; // Each barcode can only appear once in the list
BarcodeLinkListBehavior.Count; // Keep track of how many times each barcode is scanned

BarcodeLinkPlatform

Specifies the platform type for the scanning device.

import { BarcodeLinkPlatform } from "@scandit/web-barcode-link";

barcodeLink.setPlatform(BarcodeLinkPlatform.Web);

// Available platforms:
BarcodeLinkPlatform.Express; // Launch the Scandit Express app when scanning the QR code
BarcodeLinkPlatform.Web; // Launch a new browser tab with the Scandit Web SDK when scanning the QR code

BarcodeLinkSymbology

Imported from @scandit/web-datacapture-barcode, defines supported barcode types.

import { BarcodeLinkSymbology } from "@scandit/web-barcode-link";

barcodeLink.setSymbologies({
    [BarcodeLinkSymbology.Ean13Upca]: { enabled: true },
});

BarcodeLinkUiFlow

Default flow implementation with built-in UI.

import { BarcodeLinkUiFlow } from "@scandit/web-barcode-link";

await barcodeLink.initialize(new BarcodeLinkUiFlow());

BarcodeLinkUilessFlow

Headless flow implementation that returns QR code data.

import { BarcodeLinkUilessFlow } from "@scandit/web-barcode-link";

const qrCode = await barcodeLink.initialize(new BarcodeLinkUilessFlow());
// qrCode: { href: string, src: string }

License

Requires a valid Scandit license key.