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 { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||
|
||||
export interface BarcodeScannerOptions {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
resultDisplayDuration?: number;
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
text: string;
|
||||
}
|
||||
@ -77,10 +91,10 @@ export interface BarcodeScanResult {
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.barcodeScanner.scan().then((barcodeData) => {
|
||||
* // Success! Barcode data is here
|
||||
* }, (err) => {
|
||||
* // An error occurred
|
||||
* this.barcodeScanner.scan().then(barcodeData => {
|
||||
* console.log('Barcode data', barcodeData);
|
||||
* }).catch(err => {
|
||||
* console.log('Error', err);
|
||||
* });
|
||||
* ```
|
||||
* @interfaces
|
||||
@ -96,7 +110,6 @@ export interface BarcodeScanResult {
|
||||
})
|
||||
@Injectable()
|
||||
export class BarcodeScanner extends IonicNativePlugin {
|
||||
|
||||
Encode: {
|
||||
TEXT_TYPE: string;
|
||||
EMAIL_TYPE: string;
|
||||
@ -117,7 +130,9 @@ export class BarcodeScanner extends IonicNativePlugin {
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
scan(options?: BarcodeScannerOptions): Promise<BarcodeScanResult> { return; }
|
||||
scan(options?: BarcodeScannerOptions): Promise<BarcodeScanResult> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes data into a barcode.
|
||||
@ -127,6 +142,7 @@ export class BarcodeScanner extends IonicNativePlugin {
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@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