Trigger.io

Trigger.io Forge Documentation

Important

This documentation is deprecated, and only kept here to support users of browser extension APIs. If you are using Trigger.io for iOS or Android, see https://trigger.io/docs/.

barcode: Barcode / QR Code scanner

The forge.barcode namespace allows the user to scan a barcode using the devices camera and returns its content

Config

The barcode module must be enabled in config.json

{
    "modules": {
        "barcode": true
    }
}

API

scan

Platforms: iOS, Android

Show a UI that allows the user to scan a barcode and return its value

Example:

forge.barcode.scan(function (value) {
    alert("You scanned: "+value);
});
barcode.scan(success, error)
Arguments:
  • success (function(value)) -- callback to be invoked when no errors occur
  • error (function(content)) -- called with details of any error which may occur

scanWithFormat

Platforms: iOS, Android

Show a UI that allows the user to scan a barcode and return its value and type.

Example:

forge.barcode.scanWithFormat(function (barcode) {
  alert('You scanned a '+barcode.format+': '+barcode.value);
});
barcode.scanWithFormat(success, error)
Arguments:
  • success (function(barcode)) -- callback to be invoked when no errors occur - barcode will contain format and value keys, where format is the barcode type as returned by ZXing
  • error (function(content)) -- called with details of any error which may occur