### Install Dependencies and Run Development Server Source: https://github.com/blinkid/blinkid-in-browser/blob/master/examples/getting-started/README.md Navigate to the project directory, install dependencies, and start the development server. ```bash cd BlinkID-InBrowserSDK-GettingStarted && npm install && npm run dev ``` -------------------------------- ### Install Example Dependencies (TypeScript) Source: https://github.com/blinkid/blinkid-in-browser/blob/master/examples/README.md Installs dependencies and builds a TypeScript application. Ensure you are in the example's TypeScript folder. Runtime resources are copied to the 'dist/' folder. ```bash npm install npm run build ``` -------------------------------- ### Install Dependencies and Build TypeScript Example Source: https://github.com/blinkid/blinkid-in-browser/blob/master/ui/examples/README.md Use these commands to set up and build the TypeScript example. Ensure you are in the 'ui/examples/typescript' directory. The build process outputs to the 'dist/' folder. ```bash # Make sure you're in the 'ui/examples/typescript' folder # Install dependencies npm install # Build an application in folder 'dist/' npm run build ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/blinkid/blinkid-in-browser/blob/master/examples/getting-started/README.md Navigate to your project directory and install the necessary dependencies using npm. ```bash cd blinkid-integration npm install npm run dev ``` -------------------------------- ### Install Dependencies and Build App Source: https://github.com/blinkid/blinkid-in-browser/blob/master/examples/webpack/typescript/README.md Install project dependencies, build the application, and copy WASM resources. Serve the 'dist' folder with an HTTP/S server. ```bash npm install npm run build http-server dist/ ``` -------------------------------- ### Serve JavaScript Examples Source: https://github.com/blinkid/blinkid-in-browser/blob/master/examples/README.md Serves the JavaScript examples from the 'javascript/' folder. Requires an internet connection for runtime resources loaded from CDN, or alternatively, provide JS bundles. ```bash serve javascript/ ``` -------------------------------- ### Advanced Example and API Documentation Source: https://github.com/blinkid/blinkid-in-browser/blob/master/ui/README.md An advanced example showcasing programmatic configuration of the BlinkID component's properties and event listeners, along with references to further documentation. ```APIDOC ## Advanced Example and API Documentation This section provides an advanced example of configuring the BlinkID component using JavaScript properties and demonstrates how to handle various events. It also points to more detailed API documentation. ### JavaScript Configuration ```javascript const el = document.querySelector("blinkid-in-browser"); // Mandatory properties el.engineLocation = "http://localhost/resources"; el.workerLocation = "http://localhost/resources/blinkid.worker.min.js"; el.licenseKey = ""; el.recognizers = ["BlinkIdSingleSideRecognizer"]; // Optional properties el.allowHelloMessage = true; el.recognizerOptions = undefined; el.enableDrag = true; el.hideFeedback = false; el.hideLoadingAndErrorUi = false; el.scanFromCamera = true; el.scanFromImage = true; el.cameraId = null; el.translations = undefined; el.iconCameraDefault = undefined; el.iconCameraActive = undefined; el.iconGalleryDefault = undefined; el.iconGalleryActive = undefined; el.iconInvalidFormat = undefined; el.iconSpinner = undefined; el.translations = { "action-message": "Alternative CTA", }; // Events el.addEventListener("fatalError", (ev) => { console.log("fatalError", ev.detail); }); el.addEventListener("ready", (ev) => { console.log("ready", ev.detail); }); el.addEventListener("scanError", (ev) => { console.log("scanError", ev.detail); }); el.addEventListener("scanSuccess", (ev) => { console.log("scanSuccess", ev.detail); }); el.addEventListener("feedback", (ev) => { console.log("feedback", ev.detail); }); ``` ### Further Documentation - API documentation for the `` component can be found in the [docs/components/blinkid-in-browser/readme.md](docs/components/blinkid-in-browser/readme.md) file. ``` -------------------------------- ### Minimal BlinkID UI Component Setup Source: https://github.com/blinkid/blinkid-in-browser/blob/master/ui/demo.html Configure the BlinkID UI component with essential properties for basic scanning. Ensure a valid license key, engine location, and recognizer are provided. This example enables drag and drop functionality. ```html ``` -------------------------------- ### Install BlinkID In-Browser SDK Source: https://context7.com/blinkid/blinkid-in-browser/llms.txt Install the SDK via NPM and copy WASM resources to your public folder. Ensure WASM files are accessible via HTTPS. ```bash npm install @microblink/blinkid-in-browser-sdk # Copy WASM engine resources to your public folder cp -r node_modules/@microblink/blinkid-in-browser-sdk/resources ./public/blinkid-resources ``` -------------------------------- ### Install BlinkID SDK via NPM or Yarn Source: https://github.com/blinkid/blinkid-in-browser/blob/master/README.md Use NPM or Yarn to install the stable version of the BlinkID in-browser SDK. This is the recommended method for most projects. ```sh # NPM npm install @microblink/blinkid-in-browser-sdk # Yarn yarn add @microblink/blinkid-in-browser-sdk ``` -------------------------------- ### React: Configure postinstall Script for Resources Source: https://github.com/blinkid/blinkid-in-browser/blob/master/ui/README.md Add a `postinstall` script to `package.json` to automatically copy BlinkID SDK resources to the public directory after installation. ```json # Add `postinstall` hook to `package.json` that will copy resources { ... "scripts": { ... "postinstall": "shx cp -r node_modules/@microblink/blinkid-in-browser-sdk/resources public" ... }, ... } ``` -------------------------------- ### Minimal Example Source: https://github.com/blinkid/blinkid-in-browser/blob/master/ui/README.md A basic HTML structure to embed the BlinkID component with essential configurations and an event listener for scan success. ```APIDOC ## Minimal Example This example demonstrates the basic usage of the `` component with essential attributes and an event listener for `scanSuccess`. ### HTML ```html ``` ### JavaScript ```javascript const el = document.querySelector("blinkid-in-browser"); el.addEventListener("scanSuccess", (ev) => { console.log("Results", ev.detail); }); ``` ``` -------------------------------- ### React: Install shx for Resource Copying Source: https://github.com/blinkid/blinkid-in-browser/blob/master/ui/README.md Install `shx` as a dev dependency to help with copying BlinkID SDK resources in your React project. ```bash # Auxiliary tool for cross-platform support $ npm install --save-dev shx ``` -------------------------------- ### Install BlinkID UI Component via NPM Source: https://github.com/blinkid/blinkid-in-browser/blob/master/ui/README.md Install the SDK via NPM or Yarn, copy JS files to your project's public directory, and configure the custom element with WASM engine location. ```sh # Install latest version of UI component via NPM or Yarn npm install @microblink/blinkid-in-browser-sdk # OR yarn add @microblink/blinkid-in-browser-sdk # Copy JS file to folder where other JS assets are located cp -r node_modules/@microblink/blinkid-in-browser-sdk/ui/dist/* src/public/js/ # Copy WASM resources from SDK to folder where other static assets are located cp -r node_modules/@microblink/blinkid-in-browser-sdk/resources/* src/public/assets/ ``` ```html