From ae6a3cda7a287b98fe688afbb0bd53eeba9a01b8 Mon Sep 17 00:00:00 2001 From: Ibby Date: Tue, 6 Dec 2016 09:52:39 -0500 Subject: [PATCH] docs(): update docs --- src/plugins/media-capture.ts | 235 ++++++++++++------------- src/plugins/music-controls.ts | 28 +-- src/plugins/native-page-transitions.ts | 54 +++--- src/plugins/onesignal.ts | 129 +++++++------- src/plugins/printer.ts | 2 + src/plugins/safari-view-controller.ts | 23 +-- src/plugins/sms.ts | 3 + src/plugins/spinnerdialog.ts | 15 +- src/plugins/streaming-media.ts | 34 ++-- src/plugins/text-to-speech.ts | 2 + src/plugins/themeable-browser.ts | 3 + src/plugins/toast.ts | 2 +- src/plugins/twitter-connect.ts | 39 ++-- src/plugins/video-editor.ts | 6 + src/plugins/video-player.ts | 2 + src/plugins/z-bar.ts | 105 +++++------ 16 files changed, 351 insertions(+), 331 deletions(-) diff --git a/src/plugins/media-capture.ts b/src/plugins/media-capture.ts index 2adc95c8d..00547d4b8 100644 --- a/src/plugins/media-capture.ts +++ b/src/plugins/media-capture.ts @@ -1,9 +1,113 @@ import { Cordova, CordovaProperty, Plugin } from './plugin'; import { Observable } from 'rxjs/Observable'; - declare var navigator: any; +export interface MediaFile { + /** + * The name of the file, without path information. + */ + name: string; + /** + * The full path of the file, including the name. + */ + fullPath: string; + /** + * The file's mime type + */ + type: string; + /** + * The date and time when the file was last modified. + */ + lastModifiedDate: Date; + /** + * The size of the file, in bytes. + */ + size: number; + /** + * Retrieves the format information of the media file. + * @param {Function} successCallback + * @param {Function} errorCallback + */ + getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any); +} + +export interface MediaFileData { + /** + * The actual format of the audio and video content. + */ + codecs: string; + /** + * The average bitrate of the content. The value is zero for images. + */ + bitrate: number; + /** + * The height of the image or video in pixels. The value is zero for audio clips. + */ + height: number; + /** + * The width of the image or video in pixels. The value is zero for audio clips. + */ + width: number; + /** + * The length of the video or sound clip in seconds. The value is zero for images. + */ + duration: number; +} + +export interface CaptureError { + code: string; +} + +export interface CaptureAudioOptions { + /** + * Maximum number of audio clips. Defaults to 1. + * On iOS you can only record one file. + */ + limit?: number; + /** + * Maximum duration of an audio sound clip, in seconds. This does not work on Android devices. + */ + duration?: number; +} + +export interface CaptureImageOptions { + /** + * Maximum number of images to capture. This limit is not supported on iOS, only one image will be taken per invocation. + */ + limit?: number; +} + +export interface CaptureVideoOptions { + /** + * Maximum number of video clips to record. This value is ignored on iOS, only one video clip can be taken per invocation. + */ + limit?: number; + /** + * Maximum duration per video clip. This will be ignored on BlackBerry. + */ + duration?: number; + /** + * Quality of the video. This parameter can only be used with Android. + */ + quality?: number; +} + +export interface ConfigurationData { + /** + * The ASCII-encoded lowercase string representing the media type. + */ + type: string; + /** + * The height of the image or video in pixels. The value is zero for sound clips. + */ + height: number; + /** + * The width of the image or video in pixels. The value is zero for sound clips. + */ + width: number; +} + /** * @name Media Capture * @description @@ -20,6 +124,14 @@ declare var navigator: any; * ); * * ``` + * @interfaces + * MediaFile + * MediaFileData + * CaptureError + * CaptureAudioOptions + * CaptureImageOptions + * CaptureVideoOptions + * ConfigurationData */ @Plugin({ pluginName: 'MediaCapture', @@ -52,7 +164,7 @@ export class MediaCapture { /** * Start the audio recorder application and return information about captured audio clip files. * @param options - * @returns {Promise} + * @returns {Promise} */ @Cordova({ callbackOrder: 'reverse' @@ -100,122 +212,3 @@ export class MediaCapture { static onPendingCaptureError(): Observable { return; } } -/** - * Encapsulates properties of a media capture file. - */ -export interface MediaFile { - /** - * The name of the file, without path information. - */ - name: string; - /** - * The full path of the file, including the name. - */ - fullPath: string; - /** - * The file's mime type - */ - type: string; - /** - * The date and time when the file was last modified. - */ - lastModifiedDate: Date; - /** - * The size of the file, in bytes. - */ - size: number; - /** - * Retrieves the format information of the media file. - * @param {Function} successCallback - * @param {Function} errorCallback - */ - getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any); -} -/** - * Encapsulates format information about a media file. - */ -export interface MediaFileData { - /** - * The actual format of the audio and video content. - */ - codecs: string; - /** - * The average bitrate of the content. The value is zero for images. - */ - bitrate: number; - /** - * The height of the image or video in pixels. The value is zero for audio clips. - */ - height: number; - /** - * The width of the image or video in pixels. The value is zero for audio clips. - */ - width: number; - /** - * The length of the video or sound clip in seconds. The value is zero for images. - */ - duration: number; -} -/** - * Encapsulates the error code resulting from a failed media capture operation. - */ -export interface CaptureError { - code: string; -} -/** - * Encapsulates audio capture configuration options. - */ -export interface CaptureAudioOptions { - /** - * Maximum number of audio clips. Defaults to 1. - * On iOS you can only record one file. - */ - limit?: number; - /** - * Maximum duration of an audio sound clip, in seconds. This does not work on Android devices. - */ - duration?: number; -} -/** - * Encapsulates image capture configuration options. - */ -export interface CaptureImageOptions { - /** - * Maximum number of images to capture. This limit is not supported on iOS, only one image will be taken per invocation. - */ - limit?: number; -} -/** - * Encapsulates video capture configuration options. - */ -export interface CaptureVideoOptions { - /** - * Maximum number of video clips to record. This value is ignored on iOS, only one video clip can be taken per invocation. - */ - limit?: number; - /** - * Maximum duration per video clip. This will be ignored on BlackBerry. - */ - duration?: number; - /** - * Quality of the video. This parameter can only be used with Android. - */ - quality?: number; -} -/** - * Encapsulates a set of media capture parameters that a device supports. - */ -export interface ConfigurationData { - /** - * The ASCII-encoded lowercase string representing the media type. - */ - type: string; - /** - * The height of the image or video in pixels. The value is zero for sound clips. - */ - height: number; - /** - * The width of the image or video in pixels. The value is zero for sound clips. - */ - width: number; -} diff --git a/src/plugins/music-controls.ts b/src/plugins/music-controls.ts index baf4718e9..41145daef 100644 --- a/src/plugins/music-controls.ts +++ b/src/plugins/music-controls.ts @@ -1,5 +1,18 @@ import { Plugin, Cordova } from './plugin'; import { Observable } from 'rxjs/Observable'; + +export interface MusicControlsOptions { + track: string; + artist: string; + cover: string; + isPlaying: boolean; + dismissable: boolean; + hasPrev: boolean; + hasNext: boolean; + hasClose: boolean; + ticker: string; +} + /** * @name MusicControls * @description @@ -71,6 +84,8 @@ import { Observable } from 'rxjs/Observable'; * * * ``` + * @interfaces + * MusicControlsOptions */ @Plugin({ pluginName: 'MusicControls', @@ -79,6 +94,7 @@ import { Observable } from 'rxjs/Observable'; repo: 'https://github.com/homerours/cordova-music-controls-plugin' }) export class MusicControls { + /** * Create the media controls * @param options {MusicControlsOptions} @@ -115,15 +131,5 @@ export class MusicControls { */ @Cordova({sync: true}) static updateIsPlaying(isPlaying: boolean): void {} -} -export interface MusicControlsOptions { - track: string; - artist: string; - cover: string; - isPlaying: boolean; - dismissable: boolean; - hasPrev: boolean; - hasNext: boolean; - hasClose: boolean; - ticker: string; + } diff --git a/src/plugins/native-page-transitions.ts b/src/plugins/native-page-transitions.ts index a82599532..fbe367740 100644 --- a/src/plugins/native-page-transitions.ts +++ b/src/plugins/native-page-transitions.ts @@ -1,4 +1,20 @@ import { Plugin, Cordova } from './plugin'; + +export interface NativeTransitionOptions { + direction?: string; + duration?: number; + slowdownfactor?: number; + slidePixels?: number; + iosdelay?: number; + androiddelay?: number; + winphonedelay?: number; + fixedPixelsTop?: number; + fixedPixelsBottom?: number; + action?: string; + origin?: string; + href?: string; +} + /** * @name NativePageTransitions * @description @@ -6,9 +22,9 @@ import { Plugin, Cordova } from './plugin'; * * @usage * ``` - * import {NativePageTransitions, TransitionOptions} from 'ionic-native'; + * import {NativePageTransitions, NativeTransitionOptions} from 'ionic-native'; * - * let options: TransitionOptions = { + * let options: NativeTransitionOptions = { * direction: 'up', * duration: 500, * slowdownfactor: 3, @@ -36,60 +52,46 @@ import { Plugin, Cordova } from './plugin'; export class NativePageTransitions { /** * Perform a slide animation - * @param options {TransitionOptions} Options for the transition + * @param options {NativeTransitionOptions} Options for the transition * @returns {Promise} */ @Cordova() - static slide(options: TransitionOptions): Promise { return; } + static slide(options: NativeTransitionOptions): Promise { return; } /** * Perform a flip animation - * @param options {TransitionOptions} Options for the transition + * @param options {NativeTransitionOptions} Options for the transition * @returns {Promise} */ @Cordova() - static flip(options: TransitionOptions): Promise { return; } + static flip(options: NativeTransitionOptions): Promise { return; } /** * Perform a fade animation - * @param options {TransitionOptions} Options for the transition + * @param options {NativeTransitionOptions} Options for the transition * @returns {Promise} */ @Cordova({platforms: ['iOS', 'Android']}) - static fade(options: TransitionOptions): Promise { return; } + static fade(options: NativeTransitionOptions): Promise { return; } /** * Perform a slide animation - * @param options {TransitionOptions} Options for the transition + * @param options {NativeTransitionOptions} Options for the transition * @returns {Promise} */ @Cordova({platforms: ['iOS', 'Android']}) - static drawer(options: TransitionOptions): Promise { return; } + static drawer(options: NativeTransitionOptions): Promise { return; } /** * Perform a slide animation - * @param options {TransitionOptions} Options for the transition + * @param options {NativeTransitionOptions} Options for the transition * @returns {Promise} */ @Cordova({platforms: ['iOS']}) - static curl(options: TransitionOptions): Promise { return; } + static curl(options: NativeTransitionOptions): Promise { return; } } -export interface TransitionOptions { - direction?: string; - duration?: number; - slowdownfactor?: number; - slidePixels?: number; - iosdelay?: number; - androiddelay?: number; - winphonedelay?: number; - fixedPixelsTop?: number; - fixedPixelsBottom?: number; - action?: string; - origin?: string; - href?: string; -} diff --git a/src/plugins/onesignal.ts b/src/plugins/onesignal.ts index 9a594fe80..c4f44568e 100644 --- a/src/plugins/onesignal.ts +++ b/src/plugins/onesignal.ts @@ -1,6 +1,69 @@ import { Cordova, Plugin } from './plugin'; import { Observable } from 'rxjs/Observable'; +export interface OneSignalNotification { + app_id: string; + contents: any; + headings?: any; + isIos?: boolean; + isAndroid?: boolean; + isWP?: boolean; + isWP_WNS?: boolean; + isAdm?: boolean; + isChrome?: boolean; + isChromeWeb?: boolean; + isSafari?: boolean; + isAnyWeb?: boolean; + included_segments?: string[]; + excluded_segments?: string[]; + include_player_ids?: string[]; + include_ios_tokens?: string[]; + include_android_reg_ids?: string[]; + include_wp_uris?: string[]; + include_wp_wns_uris?: string[]; + include_amazon_reg_ids?: string[]; + include_chrome_reg_ids?: string[]; + include_chrome_web_reg_ids?: string[]; + app_ids?: string[]; + tags?: any[]; + ios_badgeType?: string; + ios_badgeCount?: number; + ios_sound?: string; + android_sound?: string; + adm_sound?: string; + wp_sound?: string; + wp_wns_sound?: string; + data?: any; + buttons?: any; + small_icon?: string; + large_icon?: string; + big_picture?: string; + adm_small_icon?: string; + adm_large_icon?: string; + adm_big_picture?: string; + chrome_icon?: string; + chrome_big_picture?: string; + chrome_web_icon?: string; + firefox_icon?: string; + url?: string; + send_after?: string; + delayed_option?: string; + delivery_time_of_day?: string; + android_led_color?: string; + android_accent_color?: string; + android_visibility?: number; + content_available?: boolean; + amazon_background_data?: boolean; + template_id?: string; + android_group?: string; + android_group_message?: any; + adm_group?: string; + adm_group_message?: any; + ttl?: number; + priority?: number; + ios_category?: string; +} + /** * @name OneSignal * @description @@ -27,7 +90,8 @@ import { Observable } from 'rxjs/Observable'; * * OneSignal.endInit(); * ``` - * + * @interfaces + * OneSignalNotification */ @Plugin({ pluginName: 'OneSignal', @@ -230,66 +294,3 @@ export class OneSignal { }): void { } } - -export interface OneSignalNotification { - app_id: string; - contents: any; - headings?: any; - isIos?: boolean; - isAndroid?: boolean; - isWP?: boolean; - isWP_WNS?: boolean; - isAdm?: boolean; - isChrome?: boolean; - isChromeWeb?: boolean; - isSafari?: boolean; - isAnyWeb?: boolean; - included_segments?: string[]; - excluded_segments?: string[]; - include_player_ids?: string[]; - include_ios_tokens?: string[]; - include_android_reg_ids?: string[]; - include_wp_uris?: string[]; - include_wp_wns_uris?: string[]; - include_amazon_reg_ids?: string[]; - include_chrome_reg_ids?: string[]; - include_chrome_web_reg_ids?: string[]; - app_ids?: string[]; - tags?: any[]; - ios_badgeType?: string; - ios_badgeCount?: number; - ios_sound?: string; - android_sound?: string; - adm_sound?: string; - wp_sound?: string; - wp_wns_sound?: string; - data?: any; - buttons?: any; - small_icon?: string; - large_icon?: string; - big_picture?: string; - adm_small_icon?: string; - adm_large_icon?: string; - adm_big_picture?: string; - chrome_icon?: string; - chrome_big_picture?: string; - chrome_web_icon?: string; - firefox_icon?: string; - url?: string; - send_after?: string; - delayed_option?: string; - delivery_time_of_day?: string; - android_led_color?: string; - android_accent_color?: string; - android_visibility?: number; - content_available?: boolean; - amazon_background_data?: boolean; - template_id?: string; - android_group?: string; - android_group_message?: any; - adm_group?: string; - adm_group_message?: any; - ttl?: number; - priority?: number; - ios_category?: string; -} diff --git a/src/plugins/printer.ts b/src/plugins/printer.ts index 3c7fec9bd..92feab752 100644 --- a/src/plugins/printer.ts +++ b/src/plugins/printer.ts @@ -59,6 +59,8 @@ export interface PrintOptions { * * Printer.print(content, options).then(onSuccess, onError); * ``` + * @interfaces + * PrintOptions */ @Plugin({ pluginName: 'Printer', diff --git a/src/plugins/safari-view-controller.ts b/src/plugins/safari-view-controller.ts index 900673fa8..a945248b4 100644 --- a/src/plugins/safari-view-controller.ts +++ b/src/plugins/safari-view-controller.ts @@ -1,5 +1,15 @@ import { Cordova, Plugin } from './plugin'; +export interface SafariViewControllerOptions { + url?: string; + hidden?: boolean; + toolbarColor?: string; + animated?: boolean; + showDefaultShareMenuItem?: boolean; + enterReaderModeIfAvailable?: boolean; + tintColor?: string; + transition?: string; +} /** * @name SafariViewController @@ -37,6 +47,8 @@ import { Cordova, Plugin } from './plugin'; * } * ); * ``` + * @interfaces + * SafariViewControllerOptions */ @Plugin({ pluginName: 'SafariViewController', @@ -91,14 +103,3 @@ export class SafariViewController { static mayLaunchUrl(url: string): Promise { return; } } - -export interface SafariViewControllerOptions { - url?: string; - hidden?: boolean; - toolbarColor?: string; - animated?: boolean; - showDefaultShareMenuItem?: boolean; - enterReaderModeIfAvailable?: boolean; - tintColor?: string; - transition?: string; -} diff --git a/src/plugins/sms.ts b/src/plugins/sms.ts index 36eab1e1e..36640d3a8 100644 --- a/src/plugins/sms.ts +++ b/src/plugins/sms.ts @@ -38,6 +38,9 @@ export interface SmsOptionsAndroid { * // Send a text message using default options * SMS.send('416123456', 'Hello world!'); * ``` + * @interfaces + * SmsOptions + * SmsOptionsAndroid */ @Plugin({ pluginName: 'SMS', diff --git a/src/plugins/spinnerdialog.ts b/src/plugins/spinnerdialog.ts index 7cf33f9ac..ea5e7ebd4 100644 --- a/src/plugins/spinnerdialog.ts +++ b/src/plugins/spinnerdialog.ts @@ -1,5 +1,11 @@ import { Cordova, Plugin } from './plugin'; +export interface SpinnerDialogIOSOptions { + overlayOpacity?: number; + textColorRed?: number; + textColorGreen?: number; + textColorBlue?: number; +} /** * @name Spinner Dialog @@ -13,6 +19,8 @@ import { Cordova, Plugin } from './plugin'; * * SpinnerDialog.hide(); * ``` + * @interfaces + * SpinnerDialogIOSOptions */ @Plugin({ pluginName: 'SpinnerDialog', @@ -44,10 +52,3 @@ export class SpinnerDialog { static hide(): void {} } - -export interface SpinnerDialogIOSOptions { - overlayOpacity?: number; - textColorRed?: number; - textColorGreen?: number; - textColorBlue?: number; -} diff --git a/src/plugins/streaming-media.ts b/src/plugins/streaming-media.ts index 365b085bf..8130248ea 100644 --- a/src/plugins/streaming-media.ts +++ b/src/plugins/streaming-media.ts @@ -1,4 +1,20 @@ import { Plugin, Cordova } from './plugin'; + +export interface StreamingVideoOptions { + successCallback?: Function; + errorCallback?: Function; + orientation?: string; +} + +export interface StreamingAudioOptions { + bgColor?: string; + bgImage?: string; + bgImageScale?: string; + initFullscreen?: boolean; + successCallback?: Function; + errorCallback?: Function; +} + /** * @name StreamingMedia * @description @@ -17,6 +33,9 @@ import { Plugin, Cordova } from './plugin'; * StreamingMedia.('https://path/to/video/stream', options); * * ``` + * @interfaces + * StreamingVideoOptions + * StreamingAudioOptions */ @Plugin({ pluginName: 'StreamingMedia', @@ -61,18 +80,3 @@ export class StreamingMedia { static resumeAudio(): void { } } - -export interface StreamingVideoOptions { - successCallback?: Function; - errorCallback?: Function; - orientation?: string; -} - -export interface StreamingAudioOptions { - bgColor?: string; - bgImage?: string; - bgImageScale?: string; - initFullscreen?: boolean; - successCallback?: Function; - errorCallback?: Function; -} diff --git a/src/plugins/text-to-speech.ts b/src/plugins/text-to-speech.ts index 56c762849..09e64c6b9 100644 --- a/src/plugins/text-to-speech.ts +++ b/src/plugins/text-to-speech.ts @@ -23,6 +23,8 @@ export interface TTSOptions { * .catch((reason: any) => console.log(reason)); * * ``` + * @interfaces + * TTSOptions */ @Plugin({ pluginName: 'TextToSpeech', diff --git a/src/plugins/themeable-browser.ts b/src/plugins/themeable-browser.ts index 3e22fe982..7451b83e1 100644 --- a/src/plugins/themeable-browser.ts +++ b/src/plugins/themeable-browser.ts @@ -142,6 +142,9 @@ export interface ThemeableBrowserOptions { * * ``` * We suggest that you refer to the plugin's repository for additional information on usage that may not be covered here. + * @interfaces + * ThemeableBrowserButton + * ThemeableBrowserOptions */ @Plugin({ pluginName: 'ThemeableBrowser', diff --git a/src/plugins/toast.ts b/src/plugins/toast.ts index 0e874d31a..808da1a45 100644 --- a/src/plugins/toast.ts +++ b/src/plugins/toast.ts @@ -1,7 +1,6 @@ import { Cordova, Plugin } from './plugin'; import { Observable } from 'rxjs/Observable'; - export interface ToastOptions { /** * Message to display @@ -35,6 +34,7 @@ export interface ToastOptions { verticalPadding?: number; }; } + /** * @name Toast * @description diff --git a/src/plugins/twitter-connect.ts b/src/plugins/twitter-connect.ts index c7ab762a5..7dca4e4c6 100644 --- a/src/plugins/twitter-connect.ts +++ b/src/plugins/twitter-connect.ts @@ -1,5 +1,23 @@ import { Plugin, Cordova } from './plugin'; +export interface TwitterConnectResponse { + /** + * Twitter Username + */ + userName: string; + /** + * Twitter User ID + */ + userId: string; + /** + * Twitter OAuth Secret + */ + secret: string; + /** + * Twitter OAuth Token + */ + token: string; +} /** * @name Twitter Connect @@ -25,6 +43,8 @@ import { Plugin, Cordova } from './plugin'; * * TwitterConnect.logout().then(onLogoutSuccess, onLogoutError); * ``` + * @interfaces + * TwitterConnectResponse */ @Plugin({ pluginName: 'TwitterConnect', @@ -54,21 +74,4 @@ export class TwitterConnect { @Cordova() static showUser(): Promise {return; } } -export interface TwitterConnectResponse { - /** - * Twitter Username - */ - userName: string; - /** - * Twitter User ID - */ - userId: string; - /** - * Twitter OAuth Secret - */ - secret: string; - /** - * Twitter OAuth Token - */ - token: string; -} + diff --git a/src/plugins/video-editor.ts b/src/plugins/video-editor.ts index f970655c4..bb42494b9 100644 --- a/src/plugins/video-editor.ts +++ b/src/plugins/video-editor.ts @@ -135,6 +135,12 @@ export interface VideoInfo { * .catch((error: any) => console.log('video transcode error', error)); * * ``` + * @interfaces + * TranscodeOptions + * TrimOptions + * CreateThumbnailOptions + * GetVideoInfoOptions + * VideoInfo */ @Plugin({ pluginName: 'VideoEditor', diff --git a/src/plugins/video-player.ts b/src/plugins/video-player.ts index 9a1087b71..365b3550c 100644 --- a/src/plugins/video-player.ts +++ b/src/plugins/video-player.ts @@ -36,6 +36,8 @@ export interface VideoOptions { * }); * * ``` + * @interfaces + * VideoOptions */ @Plugin({ pluginName: 'VideoPlayer', diff --git a/src/plugins/z-bar.ts b/src/plugins/z-bar.ts index 5e571400a..e8c54bcfb 100644 --- a/src/plugins/z-bar.ts +++ b/src/plugins/z-bar.ts @@ -1,62 +1,5 @@ import { Plugin, Cordova } from './plugin'; -/** - * @name ZBar - * @description - * The ZBar Scanner Plugin allows you to scan 2d barcodes. - * - * Requires Cordova plugin: `cordova-plugin-cszbar`. For more info, please see the [zBar plugin docs](https://github.com/tjwoon/csZBar). - * - * @usage - * ``` - * import { ZBar } from 'ionic-native'; - * - * let zBarOptions = { - * flash: "off", - * drawSight: false - * }; - * - * ZBar.scan(zBarOptions) - * .then(result => { - * console.log(result); // Scanned code - * }) - * .catch(error => { - * console.log(error); // Error message - * }); - * - * ``` - * - * @advanced - * zBar options - * - * | Option | Type | Values | Defaults | - * |--------------------|-----------|-----------------------------------------------------------------------------------------| - * | text_title |`string?` | | `"Scan QR Code"` (Android only) | - * | text_instructions |`string?` | | `"Please point your camera at the QR code."` (Android only) | - * | camera |`string?` | `"front"`, `"back"`, | `"back"` | - * | flash |`string?` | `"on"`, `"off"`, `"auto"` | `"auto"` | - * | drawSight |`boolean?` | `true`, `false` | `true` (Draws red line in center of scanner) | - * - */ -@Plugin({ - pluginName: 'ZBar', - plugin: 'cordova-plugin-cszbar', - pluginRef: 'cloudSky.zBar', - repo: 'https://github.com/tjwoon/csZBar', - platforms: ['Android', 'iOS'] -}) -export class ZBar { - - /** - * Open the scanner - * @param options { ZBarOptions } Scan options - * @returns {Promise} Returns a Promise that resolves with the scanned string, or rejects with an error. - */ - @Cordova() - static scan(options: ZBarOptions): Promise { return; } - -} - export interface ZBarOptions { /** * A string representing the title text (Android only). @@ -90,3 +33,51 @@ export interface ZBarOptions { */ drawSight?: boolean; } + +/** + * @name ZBar + * @description + * The ZBar Scanner Plugin allows you to scan 2d barcodes. + * + * Requires Cordova plugin: `cordova-plugin-cszbar`. For more info, please see the [zBar plugin docs](https://github.com/tjwoon/csZBar). + * + * @usage + * ``` + * import { ZBar } from 'ionic-native'; + * + * let zBarOptions = { + * flash: "off", + * drawSight: false + * }; + * + * ZBar.scan(zBarOptions) + * .then(result => { + * console.log(result); // Scanned code + * }) + * .catch(error => { + * console.log(error); // Error message + * }); + * + * ``` + * + * @interfaces + * ZBarOptions + */ +@Plugin({ + pluginName: 'ZBar', + plugin: 'cordova-plugin-cszbar', + pluginRef: 'cloudSky.zBar', + repo: 'https://github.com/tjwoon/csZBar', + platforms: ['Android', 'iOS'] +}) +export class ZBar { + + /** + * Open the scanner + * @param options { ZBarOptions } Scan options + * @returns {Promise} Returns a Promise that resolves with the scanned string, or rejects with an error. + */ + @Cordova() + static scan(options: ZBarOptions): Promise { return; } + +}