UNPKG

1.76 kBTypeScriptView Raw
1export interface ZBarOptions {
2 /**
3 * A string representing the title text (Android only).
4 * Default: "Scan QR Code"
5 */
6 text_title?: string;
7 /**
8 * A string representing the instruction text (Android only).
9 * Default: "Please point your camera at the QR code."
10 */
11 text_instructions?: string;
12 /**
13 * A string defining the active camera when opening the scanner.
14 * Possible values: "front", "back"
15 * Default: "back"
16 */
17 camera?: string;
18 /**
19 * A string defining the state of the flash.
20 * Possible values: "on", "off", "auto"
21 * Default: "auto"
22 */
23 flash?: string;
24 /**
25 * A boolean to show or hide a line in the center of the scanner.
26 * Default: true
27 */
28 drawSight?: boolean;
29}
30/**
31 * @name ZBar
32 * @description
33 * The ZBar Scanner Plugin allows you to scan 2d barcodes.
34 *
35 * Requires Cordova plugin: `cordova-plugin-cszbar`. For more info, please see the [zBar plugin docs](https://github.com/tjwoon/csZBar).
36 *
37 * @usage
38 * ```
39 * import { ZBar } from 'ionic-native';
40 *
41 * let zBarOptions = {
42 * flash: "off",
43 * drawSight: false
44 * };
45 *
46 * ZBar.scan(zBarOptions)
47 * .then(result => {
48 * console.log(result); // Scanned code
49 * })
50 * .catch(error => {
51 * console.log(error); // Error message
52 * });
53 *
54 * ```
55 *
56 * @interfaces
57 * ZBarOptions
58 */
59export declare class ZBar {
60 /**
61 * Open the scanner
62 * @param options { ZBarOptions } Scan options
63 * @returns {Promise<any>} Returns a Promise that resolves with the scanned string, or rejects with an error.
64 */
65 static scan(options: ZBarOptions): Promise<any>;
66}