1.1.2 • Published 12 months ago

wishlist-scanner v1.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months ago

How to install

You can install the library using the following commands:

  • Using npm: npm install wishlist-scanner
  • Using yarn: yarn add wishlist-scanner

Getting started

  1. First, add some <div> elements to your markup where you want to initialize the scanner. Here’s an example:
<div id="reader-wrapper">
      <div id="reader"></div>
  </div>

IMPORTANT: The id attributes of the elements must match the example above.

  1. Import the BarcodeScanner class in your JavaScript code:
import { BarcodeScanner } from "wishlist-scanner";
  1. Initialize the scanner by creating an object with the required parameters:
const accessToken = "YOUR_ACCESS_TOKEN";
const tenant = "YOUR_TENANT";
const customerRef = "YOUR_CUSTOMER_REF";

const scanner = new BarcodeScanner(accessToken, tenant, customerRef);

4 . To start scanning, use the following method:

scanner.scanBarcode();

Example of usage

Here’s an example of how you can use the scanner in your index.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Barcode Scanner</title>
</head>
<body>
    <button id="reader-init">Scan</button>
    <div id="reader-wrapper">
        <div id="reader"></div>
    </div>
    <script type="module" src="main.js"></script>
</body>
</html>

And in your main.js:

import { BarcodeScanner } from "wishlist-scanner";

const accessToken = "YOUR_ACCESS_TOKEN";
const tenant = "YOUR_TENANT";
const customerRef = "YOUR_CUSTOMER_REF";

const scanner = new BarcodeScanner(accessToken, tenant, customerRef);

document.getElementById("reader-init").addEventListener("click", async () => {
    scanner.scanBarcode();
});
1.1.2

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago