### Quagga.start API Method Source: https://github.com/ericblade/quagga2/blob/master/README.md Starts the video stream and begins the process of locating and decoding images. This method should be called after the library has been successfully initialized. ```APIDOC Quagga.start() ``` -------------------------------- ### CameraAccess.request Method Source: https://github.com/ericblade/quagga2/blob/master/README.md Initializes the camera and starts playback. Allows specifying a video element or initializing invisibly for probing. Returns a Promise that resolves on completion or rejects on error. ```APIDOC CameraAccess.request(videoElement: HTMLVideoElement | null, constraints?: MediaTrackConstraints) videoElement: The HTMLVideoElement to display the camera feed, or null to initialize invisibly. constraints: Optional MediaTrackConstraints to guide camera selection by the browser. Returns: Promise - Resolves when the camera is initialized and playback starts, rejects on error. ``` -------------------------------- ### Run Quagga2 Tests with npm Source: https://github.com/ericblade/quagga2/blob/master/README.md Instructions to install dependencies and execute the test suite using npm commands. This is the standard method for running tests locally. ```console > npm install > npm run test ``` -------------------------------- ### Main Script Execution: Camera Setup and Canvas Rendering Source: https://github.com/ericblade/quagga2/blob/master/example/camera_example.html This block executes when the window finishes loading. It defines camera constraints (e.g., minimum resolution), creates a video and a canvas element, appends them to the document body, initializes the camera with the specified constraints, and then sets up the canvas dimensions before continuously copying the video stream to it. ```JavaScript window.addEventListener('load', function() { var constraints = { video: { mandatory: { minWidth: 1280, minHeight: 720 } } }, video = document.createElement('video'), canvas = document.createElement('canvas'); document.body.appendChild(video); document.body.appendChild(canvas); initCamera(constraints, video, function() { canvas.setAttribute('width', video.videoWidth); canvas.setAttribute('height', video.videoHeight); copyToCanvas(video, canvas.getContext('2d')); }); }, false); ``` -------------------------------- ### Quagga2 Decoder Configuration Example Source: https://github.com/ericblade/quagga2/blob/master/README.md This JavaScript object demonstrates the basic configuration for the Quagga2 decoder, specifying the barcode readers to use, debugging options, and whether to decode multiple barcodes. ```javascript { readers: [ 'code_128_reader' ], debug: { drawBoundingBox: false, showFrequency: false, drawScanline: false, showPattern: false } multiple: false } ``` -------------------------------- ### Build Quagga2 Library Locally Source: https://github.com/ericblade/quagga2/blob/master/README.md Commands to install dependencies and build the Quagga2 library from source. This process generates 'quagga.js' (non-optimized) and 'quagga.min.js' (minified) files in the 'dist' folder, along with a source map. ```console npm install npm run build ``` -------------------------------- ### Install Quagga2 via NPM Source: https://github.com/ericblade/quagga2/blob/master/README.md Installs the Quagga2 library as a dependency in your project using npm. This command adds the package to your project's 'node_modules' and updates 'package.json'. ```console npm install --save @ericblade/quagga2 ``` -------------------------------- ### Run Quagga2 Tests using Docker Compose Source: https://github.com/ericblade/quagga2/blob/master/README.md Instructions to execute tests using Docker Compose, simplifying the management of multi-container Docker applications. This method is preferred for more complex setups. ```console > docker-compose run nodejs npm install > docker-compose run nodejs npm run test ``` -------------------------------- ### Quagga2 Result Object Example Source: https://github.com/ericblade/quagga2/blob/master/README.md An example of the data object structure received by callbacks such as 'onProcessed', 'onDetected', and 'decodeSingle'. This object contains detailed information about the barcode decoding process, including the decoded code, format, line, angle, and bounding box coordinates. Some fields may be undefined or empty depending on the success of the operation. ```javascript { "codeResult": { "code": "FANAVF1461710", "format": "code_128", "start": 355, "end": 26, "codeset": 100, "startInfo": { "error": 1.0000000000000002, "code": 104, "start": 21, "end": 41 }, "decodedCodes": [{ "code": 104, "start": 21, "end": 41 }, { "error": 0.8888888888888893, "code": 106, "start": 328, "end": 350 }], "endInfo": { "error": 0.8888888888888893, "code": 106, "start": 328, "end": 350 }, "direction": -1 }, "line": [{ "x": 25.97278706156836, "y": 360.5616435369468 }, { "x": 401.9220519377024, "y": 70.87524989906444 }], "angle": -0.6565217179979483, "pattern": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, /* ... */ 1], "box": [ [77.4074243622672, 410.9288668804402], [0.050203235235130705, 310.53619724086366], [360.15706727788256, 33.05711026051813], [437.5142884049146, 133.44977990009465] ], "boxes": [ [ [77.4074243622672, 410.9288668804402], [0.050203235235130705, 310.53619724086366], [360.15706727788256, 33.05711026051813], [437.5142884049146, 133.44977990009465] ], [ [248.90769330706507, 415.2041489551161], [198.9532321622869, 352.62160512937635], [339.546160777576, 240.3979259789976], [389.5006219223542, 302.98046980473737] ] ] } ``` -------------------------------- ### Create Quagga ResultCollector Instance Source: https://github.com/ericblade/quagga2/blob/master/README.md Example JavaScript code demonstrating how to instantiate a `ResultCollector` with various configuration options, including capture settings, capacity limits, blacklisted codes, and a custom filter function. ```javascript var resultCollector = Quagga.ResultCollector.create({ capture: true, // keep track of the image producing this result capacity: 20, // maximum number of results to store blacklist: [ // list containing codes which should not be recorded {code: "3574660239843", format: "ean_13"}], filter: function(codeResult) { // only store results which match this constraint // returns true/false // e.g.: return codeResult.format === "ean_13"; return true; } }); ``` -------------------------------- ### Quagga2 Locator Configuration Example Source: https://github.com/ericblade/quagga2/blob/master/README.md This JavaScript object illustrates the configuration for the Quagga2 locator, controlling the barcode localization process. Key properties include `halfSample` for performance and `patchSize` for search grid density, along with various debugging options. ```javascript { halfSample: true, patchSize: "medium", // x-small, small, medium, large, x-large debug: { showCanvas: false, showPatches: false, showFoundPatches: false, showSkeleton: false, showLabels: false, showPatchLabels: false, showRemainingPatchLabels: false, boxFromPatches: { showTransformed: false, showTransformedBox: false, showBB: false } } } ``` -------------------------------- ### Build Quagga2 Library with Docker Compose Source: https://github.com/ericblade/quagga2/blob/master/README.md Commands to build the Quagga2 library using Docker Compose. This method leverages a defined 'nodejs' service for dependency installation and the build process, with artifacts appearing in 'dist/'. ```console docker-compose run nodejs npm install docker-compose run nodejs npm run build ``` -------------------------------- ### Decode Single Barcode in Browser with QuaggaJS Source: https://github.com/ericblade/quagga2/blob/master/README.md This example demonstrates how to use Quagga.decodeSingle to scan a single image for Code128 barcodes in a browser environment. It configures the decoder to use the 'code_128_reader' and enables the locating mechanism for improved accuracy, printing the result to the console. ```javascript Quagga.decodeSingle({ decoder: { readers: ["code_128_reader"] // List of active readers }, locate: true, // try to locate the barcode in the image src: '/test/fixtures/code_128/image-001.jpg' // or 'data:image/jpg;base64,' + data }, function(result){ if(result.codeResult) { console.log("result", result.codeResult.code); } else { console.log("not detected"); } }); ``` -------------------------------- ### Decode Single Barcode in Node.js with QuaggaJS Source: https://github.com/ericblade/quagga2/blob/master/README.md This example shows how to integrate QuaggaJS into a Node.js environment for single image barcode decoding. It's similar to the browser version but explicitly sets `numOfWorkers` to 0, as Node.js does not support web-workers out of the box. It also restricts the input image size and uses the 'code_128_reader'. ```javascript var Quagga = require('quagga').default; Quagga.decodeSingle({ src: "image-abc-123.jpg", numOfWorkers: 0, // Needs to be 0 when used within node inputStream: { size: 800 // restrict input-size to be 800px in width (long-side) }, decoder: { readers: ["code_128_reader"] // List of active readers } }, function(result) { if(result.codeResult) { console.log("result", result.codeResult.code); } else { console.log("not detected"); } }); ``` -------------------------------- ### Polyfilling getUserMedia for Cross-Browser Camera Access Source: https://github.com/ericblade/quagga2/blob/master/example/camera_example.html This snippet provides polyfills for `navigator.getUserMedia` and `window.URL` to ensure broader compatibility across different browsers. The `getUserMedia` wrapper function simplifies the process of acquiring a camera stream, handling the creation of an object URL for the video source. ```JavaScript navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia; window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL; function getUserMedia(constraints, success, failure) { navigator.getUserMedia(constraints, function(stream) { var videoSrc = (window.URL && window.URL.createObjectURL(stream)) || stream; success.apply(null, [videoSrc]); }, failure); } ``` -------------------------------- ### Initializing Camera Stream and Handling Video Playback Source: https://github.com/ericblade/quagga2/blob/master/example/camera_example.html The `initCamera` function takes camera constraints, a video element, and a callback. It uses `getUserMedia` to acquire the stream, sets it as the video source, and then waits for the video to load and report valid dimensions before playing. A retry mechanism is included to ensure the video is ready before proceeding. ```JavaScript function initCamera(constraints, video, callback) { getUserMedia(constraints, function (src) { video.src = src; video.addEventListener('loadeddata', function() { var attempts = 10; function checkVideo() { if (attempts > 0) { if (video.videoWidth > 0 && video.videoHeight > 0) { console.log(video.videoWidth + "px x " + video.videoHeight + "px"); video.play(); callback(); } else { window.setTimeout(checkVideo, 100); } } else { callback('Unable to play video stream.'); } attempts--; } checkVideo(); }, false); }, function(e) { console.log(e); }); } ``` -------------------------------- ### Quagga.init API Method Source: https://github.com/ericblade/quagga2/blob/master/README.md Initializes the Quagga2 library for a given configuration and invokes a callback when bootstrapping is complete. Requests camera access if 'LiveStream' is configured. The 'err' parameter in the callback provides error details if initialization fails (e.g., unsupported API, permission denied). The 'target' can be a CSS selector or a DOM node. ```APIDOC Quagga.init(config, callback) config: object - Configuration object for Quagga2. inputStream: object - Configuration for the input stream. name: string - Name of the stream (e.g., "Live"). type: string - Type of the stream (e.g., "LiveStream"). target: string | DOM node - CSS selector or DOM node for the video element (optional, defaults to '#interactive.viewport'). decoder: object - Configuration for the decoder. readers: array - Array of barcode readers to use (e.g., ["code_128_reader"]). callback: function(err) - Callback function invoked after initialization. err: Error | undefined - Error object if initialization fails (e.g., camera access denied, unsupported API). ``` -------------------------------- ### Build Quagga2 Library with Docker Source: https://github.com/ericblade/quagga2/blob/master/README.md Instructions for building the Quagga2 library using Docker. This approach ensures a consistent build environment and places the artifacts in the 'dist/' folder via bind-mounting. ```console docker build --tag quagga2/build . docker run -v $(pwd):/quagga2 quagga2/build npm install docker run -v $(pwd):/quagga2 quagga2/build npm run build ``` -------------------------------- ### Initialize Quagga2 with Configuration Source: https://github.com/ericblade/quagga2/blob/master/README.md Initializes the Quagga2 library with a given configuration object. This process may request camera access if 'LiveStream' is configured. A callback function is invoked upon completion or if an error occurs, such as browser API limitations or user denial of camera permissions. The 'target' property can be a CSS selector string or a DOM node. ```javascript Quagga.init({ inputStream : { name : "Live", type : "LiveStream", target: document.querySelector('#yourElement') // Or '#yourElement' (optional) }, decoder : { readers : ["code_128_reader"] } }, function(err) { if (err) { console.log(err); return } console.log("Initialization finished. Ready to start"); Quagga.start(); }); ``` -------------------------------- ### Run Quagga2 Tests using Docker Build and Run Source: https://github.com/ericblade/quagga2/blob/master/README.md Steps to build a Docker image for Quagga2 and then run tests within a Docker container. This ensures a consistent testing environment. ```console > docker build --tag quagga2/build . > docker run -v $(pwd):/quagga2 npm install > docker run -v $(pwd):/quagga2 npm run test ``` -------------------------------- ### Include Quagga2 via CDN Links Source: https://github.com/ericblade/quagga2/blob/master/README.md Provides options to include Quagga2 directly in an HTML page using CDN links for both the full and minified versions. It also shows how to specify a particular library version. ```html ``` ```html ``` ```html ``` -------------------------------- ### Continuously Copying Video Stream to Canvas Source: https://github.com/ericblade/quagga2/blob/master/example/camera_example.html This `copyToCanvas` function continuously draws the content of a video element onto a 2D canvas context. It utilizes `window.requestAnimationFrame` to ensure smooth and efficient rendering, creating a live feed from the video to the canvas. ```JavaScript function copyToCanvas(video, ctx) { ( function frame() { ctx.drawImage(video, 0, 0); window.requestAnimationFrame(frame); }()); } ``` -------------------------------- ### CameraAccess.enableTorch Method Source: https://github.com/ericblade/quagga2/blob/master/README.md Turns on the camera's torch (flash). Returns a Promise that resolves on completion or rejects on error. Note: May not work reliably on all iOS versions. ```APIDOC CameraAccess.enableTorch() Returns: Promise - Resolves when the torch is turned on, rejects on error. ``` -------------------------------- ### Detecting getUserMedia API Support in JavaScript Source: https://github.com/ericblade/quagga2/blob/master/README.md This snippet demonstrates how to safely check for the availability of the `navigator.mediaDevices.getUserMedia` function in a web browser. It's highly recommended to include `webrtc-adapter` in your project for better cross-browser compatibility due to varying implementations. ```javascript if (navigator.mediaDevices && typeof navigator.mediaDevices.getUserMedia === 'function') { // safely access `navigator.mediaDevices.getUserMedia` } ``` -------------------------------- ### CameraAccess.enumerateVideoDevices Method Source: https://github.com/ericblade/quagga2/blob/master/README.md Enumerates available media devices, filters for 'videoinput' kind, and returns an array of MediaDeviceInfo objects. Useful for allowing users to select a camera. ```APIDOC CameraAccess.enumerateVideoDevices() Returns: Promise - Resolves with an array of MediaDeviceInfo objects for video input devices. ``` -------------------------------- ### Include Quagga2 via Local Script Tag Source: https://github.com/ericblade/quagga2/blob/master/README.md Includes the Quagga2 library in an HTML page by referencing a local 'quagga.js' file. This method requires you to manually copy the 'quagga.js' file into your project. ```html ``` -------------------------------- ### Import Quagga2 in JavaScript Projects Source: https://github.com/ericblade/quagga2/blob/master/README.md Demonstrates how to import Quagga2 into a JavaScript project using both ES6 modules and Common JS syntax. For Common JS, it's important to access the 'default' export. ```javascript import Quagga from '@ericblade/quagga2'; // ES6 ``` ```javascript const Quagga = require('@ericblade/quagga2').default; // Common JS (important: default) ``` -------------------------------- ### Link Quagga2 Development Version to Another Project Source: https://github.com/ericblade/quagga2/blob/master/README.md Steps to link a local development version of Quagga2 to another project using npm link. This enables rapid iteration, as 'npm run build' in the Quagga2 directory will automatically update the linked version in the consuming project. ```console npm install && npm run build && npm link ``` ```console npm link @ericblade/quagga2 ``` -------------------------------- ### QuaggaJS inputStream Configuration Property Source: https://github.com/ericblade/quagga2/blob/master/README.md Defines the source of images/videos for QuaggaJS. Configurable properties include `name`, `type` (ImageStream, VideoStream, LiveStream), `constraints` for dimensions and facing mode, `area` for defining the detection rectangle, and `singleChannel` for debugging. ```javascript { name: "Live", type: "LiveStream", constraints: { width: 640, height: 480, facingMode: "environment", deviceId: "7832475934759384534" }, area: { // defines rectangle of the detection/localization area top: "0%", // top offset right: "0%", // right offset left: "0%", // left offset bottom: "0%" // bottom offset }, singleChannel: false // true: only the red color-channel is read } ``` -------------------------------- ### Quagga2 Configuration Property: locator Source: https://github.com/ericblade/quagga2/blob/master/README.md Configuration for the barcode localization process, relevant when `locate` flag is true. Controls how barcodes are found in the image. ```APIDOC locator: object halfSample: boolean (optional, default: true) Description: If true, operates on a scaled-down image (half width/height) to reduce processing time and aid pattern finding. patchSize: string (optional, default: "medium") Description: Defines the density of the search-grid, proportional to barcode size. Possible values: "x-small", "small", "medium", "large", "x-large". debug: object (optional) Description: Debugging options for the locator. showCanvas: boolean (default: false) showPatches: boolean (default: false) showFoundPatches: boolean (default: false) showSkeleton: boolean (default: false) showLabels: boolean (default: false) showPatchLabels: boolean (default: false) showRemainingPatchLabels: boolean (default: false) boxFromPatches: object showTransformed: boolean (default: false) showTransformedBox: boolean (default: false) showBB: boolean (default: false) ``` -------------------------------- ### CameraAccess.release Method Source: https://github.com/ericblade/quagga2/blob/master/README.md Pauses the active video element, stops all associated tracks, and releases all camera resources. Returns a Promise that resolves upon completion. ```APIDOC CameraAccess.release() Returns: Promise - Resolves when all tracks are stopped and resources are released. ``` -------------------------------- ### QuaggaJS Top-Level Configuration Object Source: https://github.com/ericblade/quagga2/blob/master/README.md The main configuration object for QuaggaJS, allowing fine-tuning of barcode detection and input stream settings. It includes properties like `locate`, `inputStream`, `frequency`, `decoder`, `locator`, and `debug`. ```javascript { locate: true, inputStream: {...}, frequency: 10, decoder:{...}, locator: {...}, debug: false, } ``` -------------------------------- ### Quagga.decodeSingle API Method Source: https://github.com/ericblade/quagga2/blob/master/README.md Decodes a single image provided, without relying on 'getUserMedia' for camera access. The callback function provided is identical to that used with 'onDetected', receiving the same result 'data' object. ```APIDOC Quagga.decodeSingle(config, callback) config: object - Configuration object for decoding a single image. callback: function(data) - Function called with the decoding result `data` object. ``` -------------------------------- ### Quagga.onProcessed API Method Source: https://github.com/ericblade/quagga2/blob/master/README.md Registers a callback function that is invoked for each frame after the processing is completed. The 'data' object passed to the callback contains detailed information about the success or failure of the operation, with its output varying based on detection and decoding results. ```APIDOC Quagga.onProcessed(callback) callback: function(data) - Function called after each frame is processed. data: object - Object containing processing results (varies based on success/failure). ``` -------------------------------- ### Quagga2 Configuration Property: decoder Source: https://github.com/ericblade/quagga2/blob/master/README.md Configuration for the barcode decoding process, which converts located barcodes into their true meaning. Most options are for debugging/visualization. ```APIDOC decoder: object readers: array (required) Description: An array of barcode types to decode. Possible values: "code_128_reader", "ean_reader", "ean_8_reader", "code_39_reader", "code_39_vin_reader", "codabar_reader", "upc_reader", "upc_e_reader", "i2of5_reader", "2of5_reader", "code_93_reader", "code_32_reader". For extended EAN: format: "ean_reader" config: object supplements: array Description: Array of EAN supplement readers (e.g., "ean_5_reader", "ean_2_reader"). Order matters. multiple: boolean (optional, default: false) Description: If true, the decoder continues after finding a valid barcode and returns results as an array of objects. debug: object (optional) Description: Debugging and visualization options. drawBoundingBox: boolean (default: false) showFrequency: boolean (default: false) drawScanline: boolean (default: false) showPattern: boolean (default: false) ``` -------------------------------- ### CameraAccess.getActiveStreamLabel Method Source: https://github.com/ericblade/quagga2/blob/master/README.md Retrieves the label for the currently active video track. ```APIDOC CameraAccess.getActiveStreamLabel() Returns: string - The label of the active video track. ``` -------------------------------- ### Quagga2 Configuration Property: frequency Source: https://github.com/ericblade/quagga2/blob/master/README.md This top-level property controls the scan-frequency of the video-stream. It's optional and defines the maximum number of scans per second, useful for long-running sessions to manage CPU resources. ```APIDOC frequency: number (optional) Description: Maximum number of scans per second. ``` -------------------------------- ### Quagga.ResultCollector API Reference Source: https://github.com/ericblade/quagga2/blob/master/README.md Documentation for the `ResultCollector` class, a built-in utility in Quagga for collecting and analyzing barcode scanning results, particularly useful for identifying false positives. It allows configuration of capture, capacity, blacklists, and custom filters. ```APIDOC Quagga.ResultCollector: - create(config: object): ResultCollector description: Creates a new ResultCollector instance. Parameters: config: object - Configuration options for the collector. - capture: boolean (default: false) - Keep track of the image producing this result. - capacity: number (default: unlimited) - Maximum number of results to store. - blacklist: Array - List of codes which should not be recorded. - code: string - The barcode value. - format: string - The format of the barcode (e.g., "ean_13"). - filter: function(codeResult: object): boolean - A function to apply custom filtering logic. Returns true to store the result. - registerResultCollector(collector: ResultCollector): void description: Attaches a ResultCollector instance to Quagga. Parameters: collector: ResultCollector - The collector instance to register. - getResults(): Array description: Returns an array of collected results. Returns: Array of objects, each containing: - codeResult: object - Same as in onDetected event. - frame: string - DataURL of the gray-scaled image (e.g., "data:image/png;base64,..."). ``` -------------------------------- ### Quagga2 Result Object Schema Source: https://github.com/ericblade/quagga2/blob/master/README.md Schema for the `data` object received by `onProcessed`, `onDetected`, and `decodeSingle` callbacks, detailing barcode and image processing results. Fields may be `undefined` or empty based on detection success. ```APIDOC Result Object: codeResult: object - Contains barcode decoding results. code: string - The decoded barcode as a string (e.g., "FANAVF1461710"). format: string - The format of the decoded code (e.g., "code_128", "ean_13", "upc_a"). start: number - Start index of the decoded code. end: number - End index of the decoded code. codeset: number - Codeset used for decoding. startInfo: object - Information about the start of the code. error: number code: number start: number end: number decodedCodes: array - Array of decoded code segments. code: number start: number end: number error: number (optional) endInfo: object - Information about the end of the code. error: number code: number start: number end: number direction: number - Direction of the code (-1 or 1). line: array - Array of points defining the detected barcode line. x: number - X-coordinate. y: number - Y-coordinate. angle: number - Angle of the detected barcode line. pattern: array - Array representing the barcode pattern. box: array> - Array of 4 points defining the bounding box of the detected barcode. boxes: array>> - Array of multiple bounding boxes, if applicable. ``` -------------------------------- ### CameraAccess.getActiveTrack Method Source: https://github.com/ericblade/quagga2/blob/master/README.md Retrieves the MediaStreamTrack object for the currently active video track. ```APIDOC CameraAccess.getActiveTrack() Returns: MediaStreamTrack - The active video track. ``` -------------------------------- ### Enabling Extended EAN Readers in Quagga2 Decoder Source: https://github.com/ericblade/quagga2/blob/master/README.md This configuration snippet shows how to enable extended EAN barcode supplements (EAN-2, EAN-5) within the Quagga2 decoder. Note that enabling supplements prevents reading regular EAN-13 codes with the same reader. ```javascript decoder: { readers: [{ format: "ean_reader", config: { supplements: [ 'ean_5_reader', 'ean_2_reader' ] } }] } ``` -------------------------------- ### Request Camera Permissions for QuaggaJS in Cordova/PhoneGap Source: https://github.com/ericblade/quagga2/blob/master/README.md This snippet demonstrates how to check and request camera permissions using `cordova.plugins.permissions` before initializing QuaggaJS in a Cordova or PhoneGap environment. It ensures that the application has the necessary access to the device's camera for barcode scanning. ```javascript let permissions = cordova.plugins.permissions; permissions.checkPermission(permissions.CAMERA, (res) => { if (!res.hasPermission) { permissions.requestPermission(permissions.CAMERA, open()); ``` -------------------------------- ### Quagga.onDetected API Method Source: https://github.com/ericblade/quagga2/blob/master/README.md Registers a callback function that is triggered whenever a barcode pattern has been successfully located and decoded. The 'data' object passed to the callback contains information about the decoding process, including the detected code which can be accessed via 'data.codeResult.code'. ```APIDOC Quagga.onDetected(callback) callback: function(data) - Function called when a barcode is detected and decoded. data: object - Object containing decoding results, including `data.codeResult.code`. ``` -------------------------------- ### Quagga.stop API Method Source: https://github.com/ericblade/quagga2/blob/master/README.md Stops the decoder from processing any more images. If a camera stream was initiated during initialization, this operation also disconnects the camera. ```APIDOC Quagga.stop() ``` -------------------------------- ### CameraAccess.disableTorch Method Source: https://github.com/ericblade/quagga2/blob/master/README.md Turns off the camera's torch (flash). Returns a Promise that resolves on completion or rejects on error. Note: May not work reliably on all iOS versions. ```APIDOC CameraAccess.disableTorch() Returns: Promise - Resolves when the torch is turned off, rejects on error. ``` -------------------------------- ### Quagga.offDetected API Method Source: https://github.com/ericblade/quagga2/blob/master/README.md Removes a previously registered handler function from the 'onDetected' event queue. If no specific handler is passed as an argument, all handlers currently registered for the 'onDetected' event will be removed. ```APIDOC Quagga.offDetected(handler) handler: function | undefined - The specific handler function to remove. If undefined, all handlers are removed. ``` -------------------------------- ### Quagga.offProcessed API Method Source: https://github.com/ericblade/quagga2/blob/master/README.md Removes a previously registered handler function from the 'onProcessed' event queue. If no specific handler is passed as an argument, all handlers currently registered for the 'onProcessed' event will be removed. ```APIDOC Quagga.offProcessed(handler) handler: function | undefined - The specific handler function to remove. If undefined, all handlers are removed. ```