mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-19 16:52:53 +08:00
docs(barcode-scanner): optimize example code
docs(barcode-scanner): optimize example code
This commit is contained in:
commit
1bd0b591b4
@ -1,8 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||||
|
|
||||||
export interface BarcodeScannerOptions {
|
export interface BarcodeScannerOptions {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prefer front camera. Supported on iOS and Android.
|
* Prefer front camera. Supported on iOS and Android.
|
||||||
*/
|
*/
|
||||||
@ -52,11 +51,26 @@ export interface BarcodeScannerOptions {
|
|||||||
* Display scanned text for X ms. 0 suppresses it entirely, default 1500. Supported on Android only.
|
* Display scanned text for X ms. 0 suppresses it entirely, default 1500. Supported on Android only.
|
||||||
*/
|
*/
|
||||||
resultDisplayDuration?: number;
|
resultDisplayDuration?: number;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BarcodeScanResult {
|
export interface BarcodeScanResult {
|
||||||
format: 'QR_CODE' | 'DATA_MATRIX' | 'UPC_E' | 'UPC_A' | 'EAN_8' | 'EAN_13' | 'CODE_128' | 'CODE_39' | 'CODE_93' | 'CODABAR' | 'ITF' | 'RSS14' | 'RSS_EXPANDED' | 'PDF417' | 'AZTEC' | 'MSI';
|
format:
|
||||||
|
| 'QR_CODE'
|
||||||
|
| 'DATA_MATRIX'
|
||||||
|
| 'UPC_E'
|
||||||
|
| 'UPC_A'
|
||||||
|
| 'EAN_8'
|
||||||
|
| 'EAN_13'
|
||||||
|
| 'CODE_128'
|
||||||
|
| 'CODE_39'
|
||||||
|
| 'CODE_93'
|
||||||
|
| 'CODABAR'
|
||||||
|
| 'ITF'
|
||||||
|
| 'RSS14'
|
||||||
|
| 'RSS_EXPANDED'
|
||||||
|
| 'PDF417'
|
||||||
|
| 'AZTEC'
|
||||||
|
| 'MSI';
|
||||||
cancelled: boolean;
|
cancelled: boolean;
|
||||||
text: string;
|
text: string;
|
||||||
}
|
}
|
||||||
@ -77,10 +91,10 @@ export interface BarcodeScanResult {
|
|||||||
* ...
|
* ...
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* this.barcodeScanner.scan().then((barcodeData) => {
|
* this.barcodeScanner.scan().then(barcodeData => {
|
||||||
* // Success! Barcode data is here
|
* console.log('Barcode data', barcodeData);
|
||||||
* }, (err) => {
|
* }).catch(err => {
|
||||||
* // An error occurred
|
* console.log('Error', err);
|
||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
* @interfaces
|
* @interfaces
|
||||||
@ -96,7 +110,6 @@ export interface BarcodeScanResult {
|
|||||||
})
|
})
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class BarcodeScanner extends IonicNativePlugin {
|
export class BarcodeScanner extends IonicNativePlugin {
|
||||||
|
|
||||||
Encode: {
|
Encode: {
|
||||||
TEXT_TYPE: string;
|
TEXT_TYPE: string;
|
||||||
EMAIL_TYPE: string;
|
EMAIL_TYPE: string;
|
||||||
@ -117,7 +130,9 @@ export class BarcodeScanner extends IonicNativePlugin {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
callbackOrder: 'reverse'
|
callbackOrder: 'reverse'
|
||||||
})
|
})
|
||||||
scan(options?: BarcodeScannerOptions): Promise<BarcodeScanResult> { return; }
|
scan(options?: BarcodeScannerOptions): Promise<BarcodeScanResult> {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encodes data into a barcode.
|
* Encodes data into a barcode.
|
||||||
@ -127,6 +142,7 @@ export class BarcodeScanner extends IonicNativePlugin {
|
|||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
encode(type: string, data: any): Promise<any> { return; }
|
encode(type: string, data: any): Promise<any> {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user