From a4078995db8fa5b3c40c580fcd58b01ae9204776 Mon Sep 17 00:00:00 2001 From: Ibby Date: Sat, 11 Mar 2017 14:18:26 -0500 Subject: [PATCH] docs(): update plugin docs --- .../plugins/device-motion/index.ts | 8 ++- .../plugins/device-orientation/index.ts | 7 ++- src/@ionic-native/plugins/diagnostic/index.ts | 12 +++-- src/@ionic-native/plugins/dialogs/index.ts | 25 ++++----- .../plugins/email-composer/index.ts | 11 ++-- .../plugins/estimote-beacons/index.ts | 14 +++++ src/@ionic-native/plugins/facebook/index.ts | 9 +++- .../plugins/file-chooser/index.ts | 8 ++- .../plugins/file-opener/index.ts | 8 ++- .../plugins/{filepath => file-path}/index.ts | 10 ++-- src/@ionic-native/plugins/file/index.ts | 1 + .../plugins/fingerprint-aio/index.ts | 6 ++- src/@ionic-native/plugins/firebase/index.ts | 8 ++- src/@ionic-native/plugins/flashlight/index.ts | 5 ++ src/@ionic-native/plugins/geofence/index.ts | 22 ++++---- .../plugins/globalization/index.ts | 10 ++++ .../plugins/google-analytics/index.ts | 6 ++- .../plugins/google-maps/index.ts | 10 ++++ .../plugins/google-plus/index.ts | 6 ++- .../plugins/header-color/index.ts | 6 ++- src/@ionic-native/plugins/health/index.ts | 10 +++- src/@ionic-native/plugins/hotspot/index.ts | 10 ++-- src/@ionic-native/plugins/http/index.ts | 6 ++- src/@ionic-native/plugins/httpd/index.ts | 9 +++- src/@ionic-native/plugins/ibeacon/index.ts | 16 ++++-- .../plugins/image-picker/index.ts | 6 ++- .../plugins/image-resizer/index.ts | 15 +++--- .../plugins/in-app-browser/index.ts | 8 ++- .../plugins/in-app-purchase/index.ts | 16 +++--- src/@ionic-native/plugins/insomnia/index.ts | 7 ++- src/@ionic-native/plugins/instagram/index.ts | 8 ++- src/@ionic-native/plugins/is-debug/index.ts | 8 ++- src/@ionic-native/plugins/keyboard/index.ts | 6 +++ .../plugins/launch-navigator/index.ts | 6 ++- .../plugins/launch-review/index.ts | 6 ++- .../plugins/local-notifications/index.ts | 11 ++-- .../plugins/location-accuracy/index.ts | 8 ++- src/@ionic-native/plugins/market/index.ts | 8 ++- .../plugins/media-capture/index.ts | 7 ++- src/@ionic-native/plugins/media/index.ts | 9 +++- src/@ionic-native/plugins/mixpanel/index.ts | 8 ++- .../plugins/music-controls/index.ts | 14 +++-- .../plugins/native-audio/index.ts | 22 ++++---- .../plugins/native-geocoder/index.ts | 8 ++- .../plugins/native-page-transitions/index.ts | 8 ++- .../plugins/native-storage/index.ts | 8 ++- .../plugins/navigation-bar/index.ts | 6 ++- src/@ionic-native/plugins/network/index.ts | 8 ++- src/@ionic-native/plugins/nfc/index.ts | 27 +++++----- src/@ionic-native/plugins/onesignal/index.ts | 14 +++-- src/@ionic-native/plugins/pay-pal/index.ts | 17 ++++--- .../plugins/photo-viewer/index.ts | 8 ++- src/@ionic-native/plugins/pin-dialog/index.ts | 8 ++- src/@ionic-native/plugins/pinterest/index.ts | 20 +++++--- .../plugins/power-management/index.ts | 8 ++- src/@ionic-native/plugins/printer/index.ts | 10 ++-- src/@ionic-native/plugins/rollbar/index.ts | 6 ++- .../plugins/safari-view-controller/index.ts | 15 +++--- .../plugins/screen-orientation/index.ts | 8 ++- src/@ionic-native/plugins/screenshot/index.ts | 10 ++-- .../plugins/secure-storage/index.ts | 51 ++++++++++--------- src/@ionic-native/plugins/serial/index.ts | 8 ++- src/@ionic-native/plugins/shake/index.ts | 8 ++- src/@ionic-native/plugins/sim/index.ts | 10 ++-- src/@ionic-native/plugins/sms/index.ts | 7 ++- .../plugins/social-sharing/index.ts | 8 ++- .../plugins/speech-recognition/index.ts | 18 ++++--- .../plugins/spinner-dialog/index.ts | 7 ++- .../plugins/splash-screen/index.ts | 7 ++- src/@ionic-native/plugins/sqlite/index.ts | 34 +++++-------- src/@ionic-native/plugins/status-bar/index.ts | 8 ++- .../plugins/stepcounter/index.ts | 10 ++-- .../plugins/streaming-media/index.ts | 6 ++- src/@ionic-native/plugins/stripe/index.ts | 8 ++- .../plugins/text-to-speech/index.ts | 8 ++- .../plugins/themeable-browser/index.ts | 13 +++-- .../plugins/three-dee-touch/index.ts | 17 ++++--- src/@ionic-native/plugins/toast/index.ts | 11 ++-- src/@ionic-native/plugins/touch-id/index.ts | 16 +++--- src/@ionic-native/plugins/transfer/index.ts | 50 +++++++----------- .../plugins/twitter-connect/index.ts | 10 ++-- src/@ionic-native/plugins/vibration/index.ts | 9 ++-- .../plugins/video-editor/index.ts | 8 ++- .../plugins/video-player/index.ts | 5 +- src/@ionic-native/plugins/web-intent/index.ts | 8 ++- .../plugins/youtube-video-player/index.ts | 9 +++- src/@ionic-native/plugins/z-bar/index.ts | 10 ++-- src/@ionic-native/plugins/zip/index.ts | 8 ++- 88 files changed, 646 insertions(+), 331 deletions(-) rename src/@ionic-native/plugins/{filepath => file-path}/index.ts (83%) diff --git a/src/@ionic-native/plugins/device-motion/index.ts b/src/@ionic-native/plugins/device-motion/index.ts index 681d01207..ede9e0ed7 100644 --- a/src/@ionic-native/plugins/device-motion/index.ts +++ b/src/@ionic-native/plugins/device-motion/index.ts @@ -44,14 +44,18 @@ export interface DeviceMotionAccelerometerOptions { * ```typescript * import { DeviceMotion, DeviceMotionAccelerationData } from '@ionic-native/device-motion'; * + * constructor(private deviceMotion: DeviceMotion) { } + * + * ... + * * // Get the device current acceleration - * DeviceMotion.getCurrentAcceleration().then( + * this.deviceMotion.getCurrentAcceleration().then( * (acceleration: DeviceMotionAccelerationData) => console.log(acceleration), * (error: any) => console.log(error) * ); * * // Watch device acceleration - * var subscription = DeviceMotion.watchAcceleration().subscribe((acceleration: DeviceMotionAccelerationData) => { + * var subscription = this.deviceMotion.watchAcceleration().subscribe((acceleration: DeviceMotionAccelerationData) => { * console.log(acceleration); * }); * diff --git a/src/@ionic-native/plugins/device-orientation/index.ts b/src/@ionic-native/plugins/device-orientation/index.ts index 3d293822f..0aa29c5f5 100644 --- a/src/@ionic-native/plugins/device-orientation/index.ts +++ b/src/@ionic-native/plugins/device-orientation/index.ts @@ -50,15 +50,18 @@ export interface DeviceOrientationCompassOptions { * // DeviceOrientationCompassHeading is an interface for compass * import { DeviceOrientation, DeviceOrientationCompassHeading } from '@ionic-native/device-orientation'; * + * constructor(private deviceOrientation: DeviceOrientation) { } + * + * ... * * // Get the device current compass heading - * DeviceOrientation.getCurrentHeading().then( + * this.deviceOrientation.getCurrentHeading().then( * (data: DeviceOrientationCompassHeading) => console.log(data), * (error: any) => console.log(error) * ); * * // Watch the device compass heading change - * var subscription = DeviceOrientation.watchHeading().subscribe( + * var subscription = this.deviceOrientation.watchHeading().subscribe( * (data: DeviceOrientationCompassHeading) => console.log(data) * ); * diff --git a/src/@ionic-native/plugins/diagnostic/index.ts b/src/@ionic-native/plugins/diagnostic/index.ts index 626537f1f..fa94945f7 100644 --- a/src/@ionic-native/plugins/diagnostic/index.ts +++ b/src/@ionic-native/plugins/diagnostic/index.ts @@ -10,17 +10,21 @@ import {Cordova, Plugin, CordovaProperty} from '@ionic-native/core'; * ```typescript * import { Diagnostic } from '@ionic-native/diagnostic'; * + * constructor(private diagnostic: Diagnostic) { } + * + * ... + * * let successCallback = (isAvailable) => { console.log('Is available? ' + isAvailable); }; * let errorCallback = (e) => console.error(e); * - * Diagnostic.isCameraAvailable().then(successCallback).catch(errorCallback); + * this.diagnostic.isCameraAvailable().then(successCallback).catch(errorCallback); * - * Diagnostic.isBluetoothAvailable().then(successCallback, errorCallback); + * this.diagnostic.isBluetoothAvailable().then(successCallback, errorCallback); * * - * Diagnostic.getBluetoothState() + * this.diagnostic.getBluetoothState() * .then((state) => { - * if (state == Diagnostic.bluetoothStates.POWERED_ON){ + * if (state == this.diagnostic.bluetoothStates.POWERED_ON){ * // do something * } else { * // do something else diff --git a/src/@ionic-native/plugins/dialogs/index.ts b/src/@ionic-native/plugins/dialogs/index.ts index 804f57e51..ae1083860 100644 --- a/src/@ionic-native/plugins/dialogs/index.ts +++ b/src/@ionic-native/plugins/dialogs/index.ts @@ -28,7 +28,13 @@ export interface DialogsPromptCallback { * ```typescript * import { Dialogs } from '@ionic-native/dialogs'; * + * constructor(private dialogs: Dialogs) { } * + * ... + * + * this.dialogs.alert('Hello world') + * .then(() => console.log('Dialog dismissed')) + * .catch(e => console.log('Error displaying dialog', e)); * * * ``` @@ -55,11 +61,7 @@ export class Dialogs { successIndex: 1, errorIndex: 4 }) - alert( - message, - title: string = 'Alert', - buttonName: string = 'OK' - ): Promise { return; } + alert(message: string, title?: string, buttonName?: string): Promise { return; } /** * Displays a customizable confirmation dialog box. @@ -72,11 +74,7 @@ export class Dialogs { successIndex: 1, errorIndex: 4 }) - confirm( - message, - title: string = 'Confirm', - buttonLabels: Array = ['OK', 'Cancel'] - ): Promise { return; } + confirm(message, title?: string, buttonLabels?: string[]): Promise { return; } /** * Displays a native dialog box that is more customizable than the browser's prompt function. @@ -90,12 +88,7 @@ export class Dialogs { successIndex: 1, errorIndex: 5 }) - prompt( - message?: string, - title: string = 'Prompt', - buttonLabels: Array = ['OK', 'Cancel'], - defaultText: string = '' - ): Promise { return; } + prompt(message?: string, title?: string, buttonLabels?: string[], defaultText?: string): Promise { return; } /** diff --git a/src/@ionic-native/plugins/email-composer/index.ts b/src/@ionic-native/plugins/email-composer/index.ts index 388dda65f..58a6b3bb4 100644 --- a/src/@ionic-native/plugins/email-composer/index.ts +++ b/src/@ionic-native/plugins/email-composer/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin } from '@ionic-native/core'; +import { Cordova, Plugin, CordovaCheck } from '@ionic-native/core'; declare var cordova: any; @@ -38,8 +38,12 @@ export interface EmailComposerOptions { * ```typescript * import { EmailComposer } from '@ionic-native/email-composer'; * + * constructor(private emailComposer: EmailComposer) { } * - * EmailComposer.isAvailable().then((available: boolean) =>{ + * ... + * + * + * this.emailComposer.isAvailable().then((available: boolean) =>{ * if(available) { * //Now we know we can send * } @@ -61,7 +65,7 @@ export interface EmailComposerOptions { * }; * * // Send a text message using default options - * EmailComposer.open(email); + * this.emailComposer.open(email); * * ``` * @interfaces @@ -83,6 +87,7 @@ export class EmailComposer { * @param app {string?} An optional app id or uri scheme. * @returns {Promise} Resolves if available, rejects if not available */ + @CordovaCheck() isAvailable(app?: string): Promise { return new Promise((resolve, reject) => { if (app) { diff --git a/src/@ionic-native/plugins/estimote-beacons/index.ts b/src/@ionic-native/plugins/estimote-beacons/index.ts index 88a19f821..731076132 100644 --- a/src/@ionic-native/plugins/estimote-beacons/index.ts +++ b/src/@ionic-native/plugins/estimote-beacons/index.ts @@ -22,6 +22,20 @@ export interface EstimoteBeaconRegion { * @description * This plugin enables communication between a phone and Estimote Beacons peripherals. * + * @usage + * ```typescript + * import { EstimoteBeacons } from '@ionic-native/estimote-beacons'; + * + * constructor(private eb: EstimoteBeacons) { } + * + * ... + * + * this.eb.requestAlwaysAuthorization(); + * + * this.eb.enableAnalytics(true); + * + * ``` + * * @interfaces * EstimoteBeaconRegion */ diff --git a/src/@ionic-native/plugins/facebook/index.ts b/src/@ionic-native/plugins/facebook/index.ts index c2ad8c230..06f7be724 100644 --- a/src/@ionic-native/plugins/facebook/index.ts +++ b/src/@ionic-native/plugins/facebook/index.ts @@ -93,8 +93,15 @@ export interface FacebookLoginResponse { * * @usage * ```typescript - * import { Facebook } from '@ionic-native/facebook'; + * import { Facebook, FacebookLoginResponse } from '@ionic-native/facebook'; * + * constructor(private fb: Facebook) { } + * + * ... + * + * this.fb.login(['public_profile', 'user_friends', 'email']) + * .then((res: FacebookLoginResponse) => console.log('Logged into Facebook!', res)) + * .catch(e => console.log('Error logging into Facebook', e)); * * * ``` diff --git a/src/@ionic-native/plugins/file-chooser/index.ts b/src/@ionic-native/plugins/file-chooser/index.ts index 5ff2bcf67..06ce75b32 100644 --- a/src/@ionic-native/plugins/file-chooser/index.ts +++ b/src/@ionic-native/plugins/file-chooser/index.ts @@ -9,9 +9,13 @@ import { Plugin, Cordova } from '@ionic-native/core'; * * @usage * ``` - * import {FileChooser} from '@ionic-native/file'; + * import { FileChooser } from '@ionic-native/file-chooser'; * - * FileChooser.open() + * constructor(private fileChooser: FileChooser) { } + * + * ... + * + * this.fileChooser.open() * .then(uri => console.log(uri)) * .catch(e => console.log(e)); * diff --git a/src/@ionic-native/plugins/file-opener/index.ts b/src/@ionic-native/plugins/file-opener/index.ts index c3877f09d..666fc8874 100644 --- a/src/@ionic-native/plugins/file-opener/index.ts +++ b/src/@ionic-native/plugins/file-opener/index.ts @@ -8,9 +8,15 @@ import { Plugin, Cordova } from '@ionic-native/core'; * * @usage * ``` - * import {FileOpener} from '@ionic-native/file-opener'; + * import { FileOpener } from '@ionic-native/file-opener'; * + * constructor(private fileOpener: FileOpener) { } * + * ... + * + * this.fileOpener.open('path/to/file.pdf', 'application/pdf') + * .then(() => console.log('File is opened')) + * .catch(e => console.log('Error openening file', e)); * * ``` */ diff --git a/src/@ionic-native/plugins/filepath/index.ts b/src/@ionic-native/plugins/file-path/index.ts similarity index 83% rename from src/@ionic-native/plugins/filepath/index.ts rename to src/@ionic-native/plugins/file-path/index.ts index 9db5a2386..b4c21643a 100644 --- a/src/@ionic-native/plugins/filepath/index.ts +++ b/src/@ionic-native/plugins/file-path/index.ts @@ -4,16 +4,20 @@ import { Plugin, Cordova } from '@ionic-native/core'; declare var window: any; /** - * @name FilePath + * @name File Path * @description * * This plugin allows you to resolve the native filesystem path for Android content URIs and is based on code in the aFileChooser library. * * @usage * ``` - * import {FilePath} from '@ionic-native/filepath'; + * import { FilePath } from '@ionic-native/file-path'; * - * FilePath.resolveNativePath(path) + * constructor(private filePath: FilePath) { } + * + * ... + * + * this.filePath.resolveNativePath(path) * .then(filePath => console.log(filePath); * .catch(err => console.log(err); * diff --git a/src/@ionic-native/plugins/file/index.ts b/src/@ionic-native/plugins/file/index.ts index 0dfb4c5ef..8524cdad3 100644 --- a/src/@ionic-native/plugins/file/index.ts +++ b/src/@ionic-native/plugins/file/index.ts @@ -355,6 +355,7 @@ export declare var FileError: { * ... * * this.file.checkDir(this.file.dataDirectory, 'mydir').then(_ => console.log('Directory exists')).catch(err => console.log('Directory doesnt exist')); + * * ``` * * This plugin is based on several specs, including : The HTML5 File API http://www.w3.org/TR/FileAPI/ diff --git a/src/@ionic-native/plugins/fingerprint-aio/index.ts b/src/@ionic-native/plugins/fingerprint-aio/index.ts index 11ea59829..40961b284 100644 --- a/src/@ionic-native/plugins/fingerprint-aio/index.ts +++ b/src/@ionic-native/plugins/fingerprint-aio/index.ts @@ -25,7 +25,11 @@ export interface FingerprintOptions { * ```typescript * import { FingerprintAIO } from '@ionic-native/fingerprint-aio'; * - * FingerprintAIO.show({ + * constructor(private faio: FingerpirntAIO) { } + * + * ... + * + * this.faio.show({ * clientId: "Fingerprint-Demo", * clientSecret: "password" //Only necessary for Android * }) diff --git a/src/@ionic-native/plugins/firebase/index.ts b/src/@ionic-native/plugins/firebase/index.ts index 6dbfa59ce..e9fd6ed70 100644 --- a/src/@ionic-native/plugins/firebase/index.ts +++ b/src/@ionic-native/plugins/firebase/index.ts @@ -11,11 +11,15 @@ import { Observable } from 'rxjs/Observable'; * ``` * import { Firebase } from '@ionic-native/firebase'; * - * Firebase.getToken() + * constructor(private firebase: Firebase) { } + * + * ... + * + * this.firebase.getToken() * .then(token => console.log(`The token is ${token}`)) // save the token server-side and use it to push notifications to this device * .catch(error => console.error('Error getting token', error)); * - * Firebase.onTokenRefresh() + * this.firebase.onTokenRefresh() * .subscribe((token: string) => console.log(`Got a new token ${token}`)); * * ``` diff --git a/src/@ionic-native/plugins/flashlight/index.ts b/src/@ionic-native/plugins/flashlight/index.ts index 4cd4bcc9d..7ac98cddc 100644 --- a/src/@ionic-native/plugins/flashlight/index.ts +++ b/src/@ionic-native/plugins/flashlight/index.ts @@ -11,6 +11,11 @@ import { Cordova, Plugin } from '@ionic-native/core'; * ```typescript * import { Flashlight } from '@ionic-native/flashlight'; * + * constructor(private flashlight: FlashLight) { } + * + * ... + * + * this.flashlight.switchOn(); * * * ``` diff --git a/src/@ionic-native/plugins/geofence/index.ts b/src/@ionic-native/plugins/geofence/index.ts index 2e410a125..85ac13a7e 100644 --- a/src/@ionic-native/plugins/geofence/index.ts +++ b/src/@ionic-native/plugins/geofence/index.ts @@ -11,20 +11,20 @@ declare var window: any; * @usage * ``` * import { Geofence } from '@ionic-native/geofence'; - * import { Platform } from 'ionic-angular' + * * ... * - * constructor(private platform: Platform) { - * this.platform.ready().then(() => { - // initialize the plugin - * Geofence.initialize().then( - * // resolved promise does not return a value - * () => console.log('Geofence Plugin Ready'), - * (err) => console.log(err) - * ) - * }) + * constructor(private geofence: Geofence) { + * // initialize the plugin + * geofence.initialize().then( + * // resolved promise does not return a value + * () => console.log('Geofence Plugin Ready'), + * (err) => console.log(err) + * ) * } * + * ... + * * private addGeofence() { * //options describing geofence * let fence = { @@ -41,7 +41,7 @@ declare var window: any; * } * } * - * Geofence.addOrUpdate(fence).then( + * this.geofence.addOrUpdate(fence).then( * () => console.log('Geofence added'), * (err) => console.log('Geofence failed to add') * ); diff --git a/src/@ionic-native/plugins/globalization/index.ts b/src/@ionic-native/plugins/globalization/index.ts index 067aa9b94..f99bddc25 100644 --- a/src/@ionic-native/plugins/globalization/index.ts +++ b/src/@ionic-native/plugins/globalization/index.ts @@ -8,6 +8,16 @@ import { Cordova, Plugin } from '@ionic-native/core'; * ```typescript * import { Globalization } from '@ionic-native/globalization'; * + * constructor(private globalization: Globalization) { } + * + * + * ... + * + * + * this.globalization.getPreferredLanguage() + * .then(res => console.log(res)) + * .catch(e => console.log(e)); + * * * ``` */ diff --git a/src/@ionic-native/plugins/google-analytics/index.ts b/src/@ionic-native/plugins/google-analytics/index.ts index 1ad55ec87..b108889bc 100644 --- a/src/@ionic-native/plugins/google-analytics/index.ts +++ b/src/@ionic-native/plugins/google-analytics/index.ts @@ -15,7 +15,11 @@ declare var window; * ```typescript * import { GoogleAnalytics } from '@ionic-native/google-analytics'; * - * GoogleAnalytics.startTrackerWithId('YOUR_TRACKER_ID') + * constructor(private ga: GoogleAnalytics) { } + * + * ... + * + * this.ga.startTrackerWithId('YOUR_TRACKER_ID') * .then(() => { * console.log('Google analytics is ready now'); * // Tracker is ready diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index 700703843..dd3daf7d7 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -437,6 +437,16 @@ export class GoogleMap { * ``` * @classes * GoogleMap + * Marker + * LatLng + * Geocoder + * @interfaces + * AnimateCameraOptions + * MarkerOptions + * MyLocation + * MyLocationOptions + * VisibleRegion + * */ @Plugin({ pluginName: 'GoogleMaps', diff --git a/src/@ionic-native/plugins/google-plus/index.ts b/src/@ionic-native/plugins/google-plus/index.ts index a5196b847..0d6457b7c 100644 --- a/src/@ionic-native/plugins/google-plus/index.ts +++ b/src/@ionic-native/plugins/google-plus/index.ts @@ -8,7 +8,11 @@ import { Cordova, Plugin } from '@ionic-native/core'; * ```typescript * import { GooglePlus } from '@ionic-native/google-plus'; * - * GooglePlus.login() + * constructor(private googlePlus: GooglePlus) { } + * + * ... + * + * this.googlePlus.login() * .then(res => console.log(res)) * .catch(err => console.error(err)); * diff --git a/src/@ionic-native/plugins/header-color/index.ts b/src/@ionic-native/plugins/header-color/index.ts index 56401230e..53f7dda98 100644 --- a/src/@ionic-native/plugins/header-color/index.ts +++ b/src/@ionic-native/plugins/header-color/index.ts @@ -10,7 +10,11 @@ import { Plugin, Cordova } from '@ionic-native/core'; * ```typescript * import { HeaderColor } from '@ionic-native/header-color'; * - * HeaderColor.tint("#becb29"); + * constructor(private headerColor: HeaderColor) { } + * + * ... + * + * this.headerColor.tint("#becb29"); * ``` */ @Plugin({ diff --git a/src/@ionic-native/plugins/health/index.ts b/src/@ionic-native/plugins/health/index.ts index 0128f082e..82ae736ec 100644 --- a/src/@ionic-native/plugins/health/index.ts +++ b/src/@ionic-native/plugins/health/index.ts @@ -87,13 +87,13 @@ export interface HealthStoreOptions { */ value: string; - /* + /** * The source that produced this data. In iOS this is ignored and * set automatically to the name of your app. */ sourceName: string; - /* + /** * The complete package of the source that produced this data. * In Android, if not specified, it's assigned to the package of the App. In iOS this is ignored and * set automatically to the bunde id of the app. @@ -151,6 +151,12 @@ export interface HealthData { * * constructor(private health: Health) { } * + * ... + * + * this.health.isAvailable() + * .then(res => console.log(res)) + * .catch(e => console.log(e)); + * * * ``` * See description at https://github.com/dariosalvi78/cordova-plugin-health for a full list of Datatypes and see examples. diff --git a/src/@ionic-native/plugins/hotspot/index.ts b/src/@ionic-native/plugins/hotspot/index.ts index 626d14e32..2df8ed495 100644 --- a/src/@ionic-native/plugins/hotspot/index.ts +++ b/src/@ionic-native/plugins/hotspot/index.ts @@ -90,13 +90,11 @@ export interface HotspotNetworkConfig { export interface HotspotDevice { /** - * ip * Hotspot IP Address */ ip: string; /** - * mac * Hotspot MAC Address */ mac: string; @@ -109,10 +107,14 @@ export interface HotspotDevice { * @description * @usage * ```typescript - * import { Hotspot, Network } from '@ionic-native/hotspot'; + * import { Hotspot, HotspotNetwork } from '@ionic-native/hotspot'; + * + * constructor(private hotspot: Hotspot) { } + * + * ... * * - * Hotspot.scanWifi().then((networks: Array) => { + * this.hotspot.scanWifi().then((networks: Array) => { * console.log(networks); * }); * diff --git a/src/@ionic-native/plugins/http/index.ts b/src/@ionic-native/plugins/http/index.ts index cbde138b6..8b1d1acf1 100644 --- a/src/@ionic-native/plugins/http/index.ts +++ b/src/@ionic-native/plugins/http/index.ts @@ -33,7 +33,11 @@ export interface HTTPResponse { * ``` * import { HTTP } from '@ionic-native/http'; * - * HTTP.get('http://ionic.io', {}, {}) + * constructor(private http: HTTP) { } + * + * ... + * + * this.http.get('http://ionic.io', {}, {}) * .then(data => { * * console.log(data.status); diff --git a/src/@ionic-native/plugins/httpd/index.ts b/src/@ionic-native/plugins/httpd/index.ts index 10937f066..a9aae1ff7 100644 --- a/src/@ionic-native/plugins/httpd/index.ts +++ b/src/@ionic-native/plugins/httpd/index.ts @@ -26,7 +26,12 @@ export interface HttpdOptions { * Embedded httpd for Cordova apps. Light weight HTTP server. * @usage * ```typescript - * import {Httpd, HttpdOptions} from '@ionic-native/httpd'; + * import { Httpd, HttpdOptions } from '@ionic-native/httpd'; + * + * constructor(private httpd: Httpd) { } + * + * ... + * * * let options: HttpdOptions = { * www_root: 'httpd_root', // relative path to app's www directory @@ -34,7 +39,7 @@ export interface HttpdOptions { * localhost_only: false * }; * - * Httpd.startServer(options).subscribe((data) => { + * this.httpd.startServer(options).subscribe((data) => { * console.log('Server is live'); * }); * diff --git a/src/@ionic-native/plugins/ibeacon/index.ts b/src/@ionic-native/plugins/ibeacon/index.ts index 2e6cc9147..da29385f8 100644 --- a/src/@ionic-native/plugins/ibeacon/index.ts +++ b/src/@ionic-native/plugins/ibeacon/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin } from '@ionic-native/core'; +import { Cordova, Plugin, CordovaCheck } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; declare var cordova: any; @@ -234,11 +234,15 @@ export interface IBeaconDelegate { * ```typescript * import { IBeacon } from '@ionic-native/ibeacon'; * + * constructor(private ibeacon: IBeacon) { } + * + * ... + * * * // Request permission to use location on iOS - * IBeacon.requestAlwaysAuthorization(); + * this.ibeacon.requestAlwaysAuthorization(); * // create a new delegate and register it with the native layer - * let delegate = IBeacon.Delegate(); + * let delegate = this.ibeacon.Delegate(); * * // Subscribe to some of the delegate's event handlers * delegate.didRangeBeaconsInRegion() @@ -258,9 +262,9 @@ export interface IBeaconDelegate { * } * ); * - * let beaconRegion = IBeacon.BeaconRegion('deskBeacon','F7826DA6-ASDF-ASDF-8024-BC5B71E0893E'); + * let beaconRegion = this.ibeacon.BeaconRegion('deskBeacon','F7826DA6-ASDF-ASDF-8024-BC5B71E0893E'); * - * IBeacon.startMonitoringForRegion(beaconRegion) + * this.ibeacon.startMonitoringForRegion(beaconRegion) * .then( * () => console.log('Native layer recieved the request to monitoring'), * error => console.error('Native layer failed to begin monitoring: ', error) @@ -290,6 +294,7 @@ export class IBeacon { * * @returns {IBeaconDelegate} An instance of the type {@type Delegate}. */ + @CordovaCheck({ sync: true }) Delegate(): IBeaconDelegate { let delegate = new cordova.plugins.locationManager.Delegate(); @@ -390,6 +395,7 @@ export class IBeacon { * * @returns {BeaconRegion} Returns the BeaconRegion that was created */ + @CordovaCheck({ sync: true }) BeaconRegion(identifer: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion { return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay); } diff --git a/src/@ionic-native/plugins/image-picker/index.ts b/src/@ionic-native/plugins/image-picker/index.ts index f8bdd8f98..1c7164da4 100644 --- a/src/@ionic-native/plugins/image-picker/index.ts +++ b/src/@ionic-native/plugins/image-picker/index.ts @@ -41,12 +41,16 @@ export interface ImagePickerOptions { * import { ImagePicker } from '@ionic-native/image-picker'; * * + * constructor(private imagePicker: ImagePicker) { } * - * ImagePicker.getPictures(options).then((results) => { + * ... + * + * this.imagePicker.getPictures(options).then((results) => { * for (var i = 0; i < results.length; i++) { * console.log('Image URI: ' + results[i]); * } * }, (err) => { }); + * * ``` * @interfaces * ImagePickerOptions diff --git a/src/@ionic-native/plugins/image-resizer/index.ts b/src/@ionic-native/plugins/image-resizer/index.ts index 9e2fd11f1..68f471bba 100644 --- a/src/@ionic-native/plugins/image-resizer/index.ts +++ b/src/@ionic-native/plugins/image-resizer/index.ts @@ -51,6 +51,10 @@ export interface ImageResizerOptions { * ```typescript * import { ImageResizer, ImageResizerOptions } from '@ionic-native/image-resizer'; * + * constructor(private imageResizer: ImageResizer) { } + * + * ... + * * let options = { * uri: uri, * folderName: 'Protonet', @@ -59,12 +63,11 @@ export interface ImageResizerOptions { * height: 1280 * } as ImageResizerOptions; * - * ImageResizer - * .resize(options) - * .then( - * (filePath: string) => { console.log('FilePath', filePath); }, - * () => { console.log('Error occured'); } - * ) + * this.imageResizer + * .resize(options) + * .then((filePath: string) => console.log('FilePath', filePath)) + * .catch(e => console.log(e)); + * * ``` * @interfaces * ImageResizerOptions diff --git a/src/@ionic-native/plugins/in-app-browser/index.ts b/src/@ionic-native/plugins/in-app-browser/index.ts index a05cac280..33cdfc2d0 100644 --- a/src/@ionic-native/plugins/in-app-browser/index.ts +++ b/src/@ionic-native/plugins/in-app-browser/index.ts @@ -137,16 +137,20 @@ export class InAppBrowserObject { * @description Launches in app Browser * @usage * ```typescript - * import {InAppBrowser} from '@ionic-native/in-app-browser'; + * import { InAppBrowser } from '@ionic-native/in-app-browser'; + * + * constructor(private iab: InAppBrowser) { } * * * ... * * - * let browser = new InAppBrowser('https://ionic.io', '_system'); + * const browser = this.iab.create('https://ionic.io'); + * * browser.executeScript(...); * browser.insertCSS(...); * browser.close(); + * * ``` * @classes * InAppBrowserObject diff --git a/src/@ionic-native/plugins/in-app-purchase/index.ts b/src/@ionic-native/plugins/in-app-purchase/index.ts index 57d76d61a..a55e04d48 100644 --- a/src/@ionic-native/plugins/in-app-purchase/index.ts +++ b/src/@ionic-native/plugins/in-app-purchase/index.ts @@ -9,9 +9,13 @@ import { Plugin, Cordova } from '@ionic-native/core'; * * @usage * ```ts - * import {InAppPurchase} from '@ionic-native/in-app-purchase'; + * import { InAppPurchase } from '@ionic-native/in-app-purchase'; * - * InAppPurchase + * constructor(private iap: InAppPurchase) { } + * + * ... + * + * this.iap * .getProducts(['com.yourapp.prod1', 'com.yourapp.prod2', ...]) * .then((products) => { * console.log(products); @@ -22,7 +26,7 @@ import { Plugin, Cordova } from '@ionic-native/core'; * }); * * - * InAppPurchase + * this.iap * .buy('com.yourapp.prod1') * .then((data)=> { * console.log(data); @@ -42,14 +46,12 @@ import { Plugin, Cordova } from '@ionic-native/core'; * * ```ts * // fist buy the product... - * InAppPurchase + * this.iap * .buy('com.yourapp.consumable_prod1') - * .then(data => InAppPurchase.consume(data.productType, data.receipt, data.signature)) + * .then(data => this.iap.consume(data.productType, data.receipt, data.signature)) * .then(() => console.log('product was successfully consumed!')) * .catch( err=> console.log(err)) * ``` - * - * */ @Plugin({ pluginName: 'InAppPurchase', diff --git a/src/@ionic-native/plugins/insomnia/index.ts b/src/@ionic-native/plugins/insomnia/index.ts index c64343a57..a78974bf5 100644 --- a/src/@ionic-native/plugins/insomnia/index.ts +++ b/src/@ionic-native/plugins/insomnia/index.ts @@ -11,14 +11,17 @@ import { Cordova, Plugin } from '@ionic-native/core'; * ```typescript * import { Insomnia } from '@ionic-native/insomnia'; * + * constructor(private insomnia: Insomnia) { } * - * Insomnia.keepAwake() + * ... + * + * this.insomnia.keepAwake() * .then( * () => console.log('success'), * () => console.log('error') * ); * - * Insomnia.allowSleepAgain() + * this.insomnia.allowSleepAgain() * .then( * () => console.log('success'), * () => console.log('error') diff --git a/src/@ionic-native/plugins/instagram/index.ts b/src/@ionic-native/plugins/instagram/index.ts index 63068ad9c..89135ef10 100644 --- a/src/@ionic-native/plugins/instagram/index.ts +++ b/src/@ionic-native/plugins/instagram/index.ts @@ -7,9 +7,13 @@ import { Plugin, Cordova } from '@ionic-native/core'; * * @usage * ``` - * import {Instagram} from '@ionic-native/instagram'; + * import { Instagram } from '@ionic-native/instagram'; * - * Instagram.share('data:image/png;uhduhf3hfif33', 'Caption') + * constructor(private instagram: Instagram) { } + * + * ... + * + * this.instagram.share('data:image/png;uhduhf3hfif33', 'Caption') * .then(() => console.log('Shared!')) * .catch((error: any) => console.error(error)); * diff --git a/src/@ionic-native/plugins/is-debug/index.ts b/src/@ionic-native/plugins/is-debug/index.ts index f02c2eef7..b17655fde 100644 --- a/src/@ionic-native/plugins/is-debug/index.ts +++ b/src/@ionic-native/plugins/is-debug/index.ts @@ -9,9 +9,13 @@ import { Plugin, Cordova } from '@ionic-native/core'; * * @usage * ``` - * import {IsDebug} from '@ionic-native/is-debug'; + * import { IsDebug } from '@ionic-native/is-debug'; * - * IsDebug.getIsDebug() + * constructor(private isDebug: IsDebug) { } + * + * ... + * + * this.isDebug.getIsDebug() * .then((isDebug: boolean) => console.log('Is debug:', isDebug)) * .catch((error: any) => console.error(error)); * diff --git a/src/@ionic-native/plugins/keyboard/index.ts b/src/@ionic-native/plugins/keyboard/index.ts index 3bfc4de32..da7749124 100644 --- a/src/@ionic-native/plugins/keyboard/index.ts +++ b/src/@ionic-native/plugins/keyboard/index.ts @@ -10,7 +10,13 @@ import { Observable } from 'rxjs/Observable'; * ```typescript * import { Keyboard } from '@ionic-native/keyboard'; * + * constructor(private keyboard: Keyboard) { } * + * ... + * + * this.keyboard.show(); + * + * this.keyboard.close(); * * ``` */ diff --git a/src/@ionic-native/plugins/launch-navigator/index.ts b/src/@ionic-native/plugins/launch-navigator/index.ts index 43a82913c..63c7928c7 100644 --- a/src/@ionic-native/plugins/launch-navigator/index.ts +++ b/src/@ionic-native/plugins/launch-navigator/index.ts @@ -69,12 +69,16 @@ export interface LaunchNavigatorOptions { * ```typescript * import { LaunchNavigator, LaunchNavigatorOptions } from '@ionic-native/launch-navigator'; * + * constructor(private launchNavigator: LaunchNavigator) { } + * + * ... + * * let options: LaunchNavigatorOptions = { * start: 'London, ON', * app: LaunchNavigator.APPS.UBER * }; * - * LaunchNavigator.navigate('Toronto, ON', options) + * this.launchNavigator.navigate('Toronto, ON', options) * .then( * success => console.log('Launched navigator'), * error => console.log('Error launching navigator', error) diff --git a/src/@ionic-native/plugins/launch-review/index.ts b/src/@ionic-native/plugins/launch-review/index.ts index bfc3daafd..5c7d9fbcb 100644 --- a/src/@ionic-native/plugins/launch-review/index.ts +++ b/src/@ionic-native/plugins/launch-review/index.ts @@ -13,8 +13,12 @@ import { Plugin, Cordova } from '@ionic-native/core'; * ``` * import { LaunchReview } from '@ionic-native/launch-review'; * + * constructor(private launchReview: LaunchReview) { } + * + * ... + * * const appId: string = 'yourAppId'; - * LaunchReview.launch(appId) + * this.launchReview.launch(appId) * .then(() => console.log('Successfully launched store app'); * ``` */ diff --git a/src/@ionic-native/plugins/local-notifications/index.ts b/src/@ionic-native/plugins/local-notifications/index.ts index 674203ba3..8aa49a910 100644 --- a/src/@ionic-native/plugins/local-notifications/index.ts +++ b/src/@ionic-native/plugins/local-notifications/index.ts @@ -101,8 +101,13 @@ export interface ILocalNotification { * import { LocalNotifications } from '@ionic-native/local-notifications'; * * + * constructor(private localNotifications: LocalNotifications) { } + * + * ... + * + * * // Schedule a single notification - * LocalNotifications.schedule({ + * this.localNotifications.schedule({ * id: 1, * text: 'Single ILocalNotification', * sound: isAndroid? 'file://sound.mp3': 'file://beep.caf', @@ -111,7 +116,7 @@ export interface ILocalNotification { * * * // Schedule multiple notifications - * LocalNotifications.schedule([{ + * this.localNotifications.schedule([{ * id: 1, * text: 'Multi ILocalNotification 1', * sound: isAndroid ? 'file://sound.mp3': 'file://beep.caf', @@ -125,7 +130,7 @@ export interface ILocalNotification { * * * // Schedule delayed notification - * LocalNotifications.schedule({ + * this.localNotifications.schedule({ * text: 'Delayed ILocalNotification', * at: new Date(new Date().getTime() + 3600), * led: 'FF0000', diff --git a/src/@ionic-native/plugins/location-accuracy/index.ts b/src/@ionic-native/plugins/location-accuracy/index.ts index dbdba5fee..c6c0da991 100644 --- a/src/@ionic-native/plugins/location-accuracy/index.ts +++ b/src/@ionic-native/plugins/location-accuracy/index.ts @@ -9,11 +9,15 @@ import {Plugin, Cordova} from '@ionic-native/core'; * ``` * import { LocationAccuracy } from '@ionic-native/location-accuracy'; * - * LocationAccuracy.canRequest().then((canRequest: boolean) => { + * constructor(private locationAccuracy: LocationAccuracy) { } + * + * ... + * + * this.locationAccuracy.canRequest().then((canRequest: boolean) => { * * if(canRequest) { * // the accuracy option will be ignored by iOS - * LocationAccuracy.request(LocationAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY).then( + * this.locationAccuracy.request(LocationAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY).then( * () => console.log('Request successful'), * error => console.log('Error requesting location permissions', error) * ); diff --git a/src/@ionic-native/plugins/market/index.ts b/src/@ionic-native/plugins/market/index.ts index ffb654467..dc252e024 100644 --- a/src/@ionic-native/plugins/market/index.ts +++ b/src/@ionic-native/plugins/market/index.ts @@ -7,9 +7,13 @@ import { Plugin, Cordova } from '@ionic-native/core'; * * @usage * ``` - * import {Market} from '@ionic-native/market'; + * import { Market } from '@ionic-native/market'; * - * Market.open('your.package.name'); + * constructor(private market: Market) { } + * + * ... + * + * this.market.open('your.package.name'); * * ``` */ diff --git a/src/@ionic-native/plugins/media-capture/index.ts b/src/@ionic-native/plugins/media-capture/index.ts index f20cde6de..322d59419 100644 --- a/src/@ionic-native/plugins/media-capture/index.ts +++ b/src/@ionic-native/plugins/media-capture/index.ts @@ -117,8 +117,13 @@ export interface ConfigurationData { * import { MediaCapture, MediaFile, CaptureError, CaptureImageOptions } from '@ionic-native/media-capture'; * * + * constructor(private mediaCapture: MediaCapture) { } + * + * ... + * + * * let options: CaptureImageOptions = { limit: 3 }; - * MediaCapture.captureImage(options) + * this.mediaCapture.captureImage(options) * .then( * (data: MediaFile[]) => console.log(data), * (err: CaptureError) => console.error(err) diff --git a/src/@ionic-native/plugins/media/index.ts b/src/@ionic-native/plugins/media/index.ts index 3a6a00c94..d468a9918 100644 --- a/src/@ionic-native/plugins/media/index.ts +++ b/src/@ionic-native/plugins/media/index.ts @@ -189,13 +189,18 @@ export class MediaObject { * import { MediaPlugin } from '@ionic-native/media'; * * + * constructor(private media: MediaPlugin) { } + * + * + * ... + * * * // Create a MediaPlugin instance. Expects path to file or url as argument * // We can optionally pass a second argument to track the status of the media * * const onStatusUpdate = (status) => console.log(status); * - * const file = new MediaPlugin('path/to/file.mp3', onStatusUpdate); + * const file = this.media.create('path/to/file.mp3', onStatusUpdate); * * // Catch the Success & Error Output * // Platform Quirks @@ -236,7 +241,7 @@ export class MediaObject { * file.release(); * * // Recording to a file - * var newFile = new MediaPlugin('path/to/file.mp3'); + * var newFile = this.media.create('path/to/file.mp3'); * newFile.startRecord(); * * newFile.stopRecord(); diff --git a/src/@ionic-native/plugins/mixpanel/index.ts b/src/@ionic-native/plugins/mixpanel/index.ts index cae562f84..de4589102 100644 --- a/src/@ionic-native/plugins/mixpanel/index.ts +++ b/src/@ionic-native/plugins/mixpanel/index.ts @@ -10,9 +10,13 @@ declare var mixpanel: any; * * @usage * ``` - * import {Mixpanel} from '@ionic-native/mixpanel'; + * import { Mixpanel } from '@ionic-native/mixpanel'; * - * Mixpanel.init(token) + * constructor(private mixpanel: Mixpanel) { } + * + * ... + * + * this.mixpanel.init(token) * .then(onSuccess) * .catch(onError); * diff --git a/src/@ionic-native/plugins/music-controls/index.ts b/src/@ionic-native/plugins/music-controls/index.ts index 4ce535d54..247eb91bd 100644 --- a/src/@ionic-native/plugins/music-controls/index.ts +++ b/src/@ionic-native/plugins/music-controls/index.ts @@ -23,9 +23,13 @@ export interface MusicControlsOptions { * * @usage * ``` - * import {MusicControls} from '@ionic-native/music-controls'; + * import { MusicControls } from '@ionic-native/music-controls'; * - * MusicControls.create({ + * constructor(private musicControls: MusicControls) { } + * + * ... + * + * this.musicControls.create({ * track : 'Time is Running Out', // optional, default : '' * artist : 'Muse', // optional, default : '' * cover : 'albums/absolution.jpg', // optional, default : nothing @@ -44,7 +48,7 @@ export interface MusicControlsOptions { * ticker : 'Now playing "Time is Running Out"' * }); * - * MusicControls.subscribe().subscribe(action => { + * this.musicControls.subscribe().subscribe(action => { * * switch(action) { * case 'music-controls-next': @@ -79,9 +83,9 @@ export interface MusicControlsOptions { * * }); * - * MusicControls.listen(); // activates the observable above + * this.musicControls.listen(); // activates the observable above * - * MusicControls.updateIsPlaying(true); + * this.musicControls.updateIsPlaying(true); * * * ``` diff --git a/src/@ionic-native/plugins/native-audio/index.ts b/src/@ionic-native/plugins/native-audio/index.ts index 80d9b39fc..c85365ed2 100644 --- a/src/@ionic-native/plugins/native-audio/index.ts +++ b/src/@ionic-native/plugins/native-audio/index.ts @@ -5,23 +5,27 @@ import { Plugin, Cordova } from '@ionic-native/core'; * @description Native Audio Playback * @usage * ```typescript - * import {NativeAudio} from '@ionic-native/native-audio'; + * import { NativeAudio } from '@ionic-native/native-audio'; * - * NativeAudio.preloadSimple('uniqueId1', 'path/to/file.mp3').then(onSuccess, onError); - * NativeAudio.preloadComplex('uniqueId2', 'path/to/file2.mp3', 1, 1, 0).then(onSuccess, onError); + * constructor(private nativeAudio: NativeAudio) { } * - * NativeAudio.play('uniqueId1').then(onSuccess, onError); + * ... + * + * this.nativeAudio.preloadSimple('uniqueId1', 'path/to/file.mp3').then(onSuccess, onError); + * this.nativeAudio.preloadComplex('uniqueId2', 'path/to/file2.mp3', 1, 1, 0).then(onSuccess, onError); + * + * this.nativeAudio.play('uniqueId1').then(onSuccess, onError); * * // can optionally pass a callback to be called when the file is done playing - * NativeAudio.play('uniqueId1', () => console.log('uniqueId1 is done playing')); + * this.nativeAudio.play('uniqueId1', () => console.log('uniqueId1 is done playing')); * - * NativeAudio.loop('uniqueId2').then(onSuccess, onError); + * this.nativeAudio.loop('uniqueId2').then(onSuccess, onError); * - * NativeAudio.setVolumeForComplexAsset('uniqueId2', 0.6).then(onSuccess,onError); + * this.nativeAudio.setVolumeForComplexAsset('uniqueId2', 0.6).then(onSuccess,onError); * - * NativeAudio.stop('uniqueId1').then(onSuccess,onError); + * this.nativeAudio.stop('uniqueId1').then(onSuccess,onError); * - * NativeAudio.unload('uniqueId1').then(onSuccess,onError); + * this.nativeAudio.unload('uniqueId1').then(onSuccess,onError); * * ``` */ diff --git a/src/@ionic-native/plugins/native-geocoder/index.ts b/src/@ionic-native/plugins/native-geocoder/index.ts index e8f273a99..92fabb01c 100644 --- a/src/@ionic-native/plugins/native-geocoder/index.ts +++ b/src/@ionic-native/plugins/native-geocoder/index.ts @@ -11,11 +11,15 @@ import { Plugin, Cordova } from '@ionic-native/core'; * ```typescript * import { NativeGeocoder, NativeGeocoderReverseResult, NativeGeocoderForwardResult } from '@ionic-native/native-geocoder'; * - * NativeGeocoder.reverseGeocode(52.5072095, 13.1452818) + * constructor(private nativeGeocoder: NativeGeocoder) { } + * + * ... + * + * this.nativeGeocoder.reverseGeocode(52.5072095, 13.1452818) * .then((result: NativeGeocoderReverseResult) => console.log("The address is " + result.address + " in " + result.countryCode)) * .catch((error: any) => console.log(error)); * - * NativeGeocoder.forwardGeocode("Berlin") + * this.nativeGeocoder.forwardGeocode("Berlin") * .then((coordinates: NativeGeocoderForwardResult) => console.log("The coordinates are latitude=" + coordinates.latitude + " and longitude=" + coordinates.longitude)) * .catch((error: any) => console.log(error)); * ``` diff --git a/src/@ionic-native/plugins/native-page-transitions/index.ts b/src/@ionic-native/plugins/native-page-transitions/index.ts index 4c9460ddb..a5dca082d 100644 --- a/src/@ionic-native/plugins/native-page-transitions/index.ts +++ b/src/@ionic-native/plugins/native-page-transitions/index.ts @@ -23,7 +23,11 @@ export interface NativeTransitionOptions { * * @usage * ``` - * import {NativePageTransitions, NativeTransitionOptions} from '@ionic-native/native-page-transitions'; + * import { NativePageTransitions, NativeTransitionOptions } from '@ionic-native/native-page-transitions'; + * + * constructor(private nativePageTransitions: NativePageTransitions) { } + * + * ... * * let options: NativeTransitionOptions = { * direction: 'up', @@ -37,7 +41,7 @@ export interface NativeTransitionOptions { * fixedPixelsBottom: 60 * }; * - * NativePageTransitions.slide(options) + * this.nativePageTransitions.slide(options) * .then(onSuccess) * .catch(onError); * diff --git a/src/@ionic-native/plugins/native-storage/index.ts b/src/@ionic-native/plugins/native-storage/index.ts index 2f66bfb36..6fbf1c38f 100644 --- a/src/@ionic-native/plugins/native-storage/index.ts +++ b/src/@ionic-native/plugins/native-storage/index.ts @@ -10,13 +10,17 @@ import { Cordova, Plugin } from '@ionic-native/core'; * ```typescript * import { NativeStorage } from '@ionic-native/native-storage'; * - * NativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'}) + * constructor(private nativeStorage: NativeStorage) { } + * + * ... + * + * this.nativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'}) * .then( * () => console.log('Stored item!'), * error => console.error('Error storing item', error) * ); * - * NativeStorage.getItem('myitem') + * this.nativeStorage.getItem('myitem') * .then( * data => console.log(data), * error => console.error(error) diff --git a/src/@ionic-native/plugins/navigation-bar/index.ts b/src/@ionic-native/plugins/navigation-bar/index.ts index 810184f97..79acd2b80 100644 --- a/src/@ionic-native/plugins/navigation-bar/index.ts +++ b/src/@ionic-native/plugins/navigation-bar/index.ts @@ -12,8 +12,12 @@ import { Cordova, Plugin } from '@ionic-native/core'; * ```typescript * import { NavigationBar } from '@ionic-native/navigation-bar'; * + * constructor(private navigationBar: NavigationBar) { } + * + * ... + * * let autoHide: boolean = true; - * NavigationBar.hide(autoHide); + * this.navigationBar.hide(autoHide); * ``` */ @Plugin({ diff --git a/src/@ionic-native/plugins/network/index.ts b/src/@ionic-native/plugins/network/index.ts index 00715070e..900af6d8d 100644 --- a/src/@ionic-native/plugins/network/index.ts +++ b/src/@ionic-native/plugins/network/index.ts @@ -14,8 +14,12 @@ declare var navigator: any; * ```typescript * import { Network } from '@ionic-native/network'; * + * constructor(private network: Network) { } + * + * ... + * * // watch network for a disconnect - * let disconnectSubscription = Network.onDisconnect().subscribe(() => { + * let disconnectSubscription = this.network.onDisconnect().subscribe(() => { * console.log('network was disconnected :-('); * }); * @@ -24,7 +28,7 @@ declare var navigator: any; * * * // watch network for a connection - * let connectSubscription = Network.onConnect().subscribe(() => { + * let connectSubscription = this.network.onConnect().subscribe(() => { * console.log('network connected!');
 * // We just got a connection but we need to wait briefly *
 // before we determine the connection type. Might need to wait
 diff --git a/src/@ionic-native/plugins/nfc/index.ts b/src/@ionic-native/plugins/nfc/index.ts index 132ca9b59..fd7535f71 100644 --- a/src/@ionic-native/plugins/nfc/index.ts +++ b/src/@ionic-native/plugins/nfc/index.ts @@ -17,10 +17,14 @@ declare let window: any; * * @usage * ``` - * import {NFC, Ndef} from '@ionic-native/nfc'; + * import { NFC, Ndef } from '@ionic-native/nfc'; * - * let message = Ndef.textRecord('Hello world'); - * NFC.share([message]).then(onSuccess).catch(onError); + * constructor(private nfc: NFC, private ndef: Ndef) { } + * + * ... + * + * let message = this.ndef.textRecord('Hello world'); + * this.nfc.share([message]).then(onSuccess).catch(onError); * * ``` */ @@ -181,19 +185,12 @@ export class NFC { * @private */ @Injectable() +@Plugin({ + pluginName: 'NFC', + plugin: 'phonegap-nfc', + pluginRef: 'ndef' +}) export class Ndef { - /** - * @private - */ - static pluginName = 'NFC'; - /** - * @private - */ - static plugin = 'phonegap-nfc'; - /** - * @private - */ - static pluginRef = 'ndef'; @Cordova({ sync: true }) uriRecord(uri: string): any { return; } diff --git a/src/@ionic-native/plugins/onesignal/index.ts b/src/@ionic-native/plugins/onesignal/index.ts index 25e2dbbd4..b1b3a6dd3 100644 --- a/src/@ionic-native/plugins/onesignal/index.ts +++ b/src/@ionic-native/plugins/onesignal/index.ts @@ -272,19 +272,23 @@ export enum OSActionType { * ```typescript * import { OneSignal } from '@ionic-native/onesignal'; * - * OneSignal.startInit('b2f7f966-d8cc-11e4-bed1-df8f05be55ba', '703322744261'); + * constructor(private oneSignal: OneSignal) { } * - * OneSignal.inFocusDisplaying(OneSignal.OSInFocusDisplayOption.InAppAlert); + * ... * - * OneSignal.handleNotificationReceived().subscribe(() => { + * this.oneSignal.startInit('b2f7f966-d8cc-11e4-bed1-df8f05be55ba', '703322744261'); + * + * this.oneSignal.inFocusDisplaying(OneSignal.OSInFocusDisplayOption.InAppAlert); + * + * this.oneSignal.handleNotificationReceived().subscribe(() => { * // do something when notification is received * }); * - * OneSignal.handleNotificationOpened().subscribe(() => { + * this.oneSignal.handleNotificationOpened().subscribe(() => { * // do something when a notification is opened * }); * - * OneSignal.endInit(); + * this.oneSignal.endInit(); * ``` * @interfaces * OSNotification diff --git a/src/@ionic-native/plugins/pay-pal/index.ts b/src/@ionic-native/plugins/pay-pal/index.ts index 3e7cfd488..bc25c2c18 100644 --- a/src/@ionic-native/plugins/pay-pal/index.ts +++ b/src/@ionic-native/plugins/pay-pal/index.ts @@ -7,19 +7,24 @@ import { Plugin, Cordova } from '@ionic-native/core'; * * @usage * ``` - * import {PayPal, PayPalPayment, PayPalConfiguration} from "@ionic-native/pay-pal"; + * import { PayPal, PayPalPayment, PayPalConfiguration } from '@ionic-native/pay-pal'; * - * PayPal.init({ - * "PayPalEnvironmentProduction": "YOUR_PRODUCTION_CLIENT_ID", - * "PayPalEnvironmentSandbox": "YOUR_SANDBOX_CLIENT_ID" + * constructor(private payPal: PayPal) { } + * + * ... + * + * + * this.payPal.init({ + * PayPalEnvironmentProduction: "YOUR_PRODUCTION_CLIENT_ID", + * PayPalEnvironmentSandbox: "YOUR_SANDBOX_CLIENT_ID" * }).then(() => { * // Environments: PayPalEnvironmentNoNetwork, PayPalEnvironmentSandbox, PayPalEnvironmentProduction - * PayPal.prepareToRender('PayPalEnvironmentSandbox', new PayPalConfiguration({ + * this.payPal.prepareToRender('PayPalEnvironmentSandbox', new PayPalConfiguration({ * // Only needed if you get an "Internal Service Error" after PayPal login! * //payPalShippingAddressOption: 2 // PayPalShippingAddressOptionPayPal * })).then(() => { * let payment = new PayPalPayment('3.33', 'USD', 'Description', 'sale'); - * PayPal.renderSinglePaymentUI(payment).then(() => { + * this.payPal.renderSinglePaymentUI(payment).then(() => { * // Successfully paid * * // Example sandbox response diff --git a/src/@ionic-native/plugins/photo-viewer/index.ts b/src/@ionic-native/plugins/photo-viewer/index.ts index 2baa6fd64..8636d564a 100644 --- a/src/@ionic-native/plugins/photo-viewer/index.ts +++ b/src/@ionic-native/plugins/photo-viewer/index.ts @@ -7,9 +7,13 @@ import { Plugin, Cordova } from '@ionic-native/core'; * ```typescript * import { PhotoViewer } from '@ionic-native/photo-viewer'; * - * PhotoViewer.show('https://mysite.com/path/to/image.jpg'); + * constructor(private photoViewer: PhotoViewer) { } * - * PhotoViewer.show('https://mysite.com/path/to/image.jpg', 'My image title', {share: false}); + * ... + * + * this.photoViewer.show('https://mysite.com/path/to/image.jpg'); + * + * this.photoViewer.show('https://mysite.com/path/to/image.jpg', 'My image title', {share: false}); * ``` */ @Plugin({ diff --git a/src/@ionic-native/plugins/pin-dialog/index.ts b/src/@ionic-native/plugins/pin-dialog/index.ts index 157fae9aa..b0597f8c8 100644 --- a/src/@ionic-native/plugins/pin-dialog/index.ts +++ b/src/@ionic-native/plugins/pin-dialog/index.ts @@ -8,10 +8,14 @@ import { Cordova, Plugin } from '@ionic-native/core'; * * @usage * ```typescript - * import { PinDialog } from '@ionic-native/'pin-dialog; + * import { PinDialog } from '@ionic-native/pin-dialog'; * * - * PinDialog.prompt('Enter your PIN', 'Verify PIN', ['OK', 'Cancel']) + * constructor(private pinDialog: PinDialog) { } + * + * ... + * + * this.pinDialog.prompt('Enter your PIN', 'Verify PIN', ['OK', 'Cancel']) * .then( * (result: any) => { * if (result.buttonIndex == 1) console.log('User clicked OK, value is: ', result.input1); diff --git a/src/@ionic-native/plugins/pinterest/index.ts b/src/@ionic-native/plugins/pinterest/index.ts index 4bd6e2095..8779111f7 100644 --- a/src/@ionic-native/plugins/pinterest/index.ts +++ b/src/@ionic-native/plugins/pinterest/index.ts @@ -136,25 +136,29 @@ export interface PinterestPin { * ``` * import { Pinterest, PinterestUser, PinterestPin, PinterestBoard } from '@ionic-native/pinterest'; * + * constructor(private pinterest: Pinterest) { } + * + * ... + * * const scopes = [ - * Pinterest.SCOPES.READ_PUBLIC, - * Pinterest.SCOPES.WRITE_PUBLIC, - * Pinterest.SCOPES.READ_RELATIONSHIPS, - * Pinterest.SCOPES.WRITE_RELATIONSHIPS + * this.pinterest.SCOPES.READ_PUBLIC, + * this.pinterest.SCOPES.WRITE_PUBLIC, + * this.pinterest.SCOPES.READ_RELATIONSHIPS, + * this.pinterest.SCOPES.WRITE_RELATIONSHIPS * ]; * - * Pinterest.login(scopes) + * this.pinterest.login(scopes) * .then(res => console.log('Logged in!', res)) * .catch(err => console.error('Error loggin in', err)); * - * Pinterest.getMyPins() + * this.pinterest.getMyPins() * .then((pins: Array) => console.log(pins)) * .catch(err => console.error(err)); * - * Pinterest.getMe() + * this.pinterest.getMe() * .then((user: PinterestUser) => console.log(user)); * - * Pinterest.getMyBoards() + * this.pinterest.getMyBoards() * .then((boards: Array) => console.log(boards)); * * ``` diff --git a/src/@ionic-native/plugins/power-management/index.ts b/src/@ionic-native/plugins/power-management/index.ts index 23eca9f6a..194c9f84f 100644 --- a/src/@ionic-native/plugins/power-management/index.ts +++ b/src/@ionic-native/plugins/power-management/index.ts @@ -8,9 +8,13 @@ import { Plugin, Cordova } from '@ionic-native/core'; * * @usage * ``` - * import {PowerManagement} from '@ionic-native/power-management'; + * import { PowerManagement } from '@ionic-native/power-management'; * - * PowerManagement.acquire() + * constructor(private powerManagement: PowerManagement) { } + * + * ... + * + * this.powerManagement.acquire() * .then(onSuccess) * .catch(onError); * diff --git a/src/@ionic-native/plugins/printer/index.ts b/src/@ionic-native/plugins/printer/index.ts index 7c3e64a35..69d5e2470 100644 --- a/src/@ionic-native/plugins/printer/index.ts +++ b/src/@ionic-native/plugins/printer/index.ts @@ -46,9 +46,13 @@ export interface PrintOptions { * @description Prints documents or HTML rendered content * @usage * ```typescript - * import {Printer, PrintOptions} from '@ionic-native/printer'; + * import { Printer, PrintOptions } from '@ionic-native/printer'; * - * Printer.isAvailable().then(onSuccess, onError); + * constructor(private printer: Printer) { } + * + * ... + * + * this.printer.isAvailable().then(onSuccess, onError); * * let options: PrintOptions = { * name: 'MyDocument', @@ -58,7 +62,7 @@ export interface PrintOptions { * grayscale: true * }; * - * Printer.print(content, options).then(onSuccess, onError); + * this.p.print(content, options).then(onSuccess, onError); * ``` * @interfaces * PrintOptions diff --git a/src/@ionic-native/plugins/rollbar/index.ts b/src/@ionic-native/plugins/rollbar/index.ts index 4105f4fc0..2a8a1e4c6 100644 --- a/src/@ionic-native/plugins/rollbar/index.ts +++ b/src/@ionic-native/plugins/rollbar/index.ts @@ -11,7 +11,11 @@ import { Plugin, Cordova } from '@ionic-native/core'; * ``` * import { Rollbar } from '@ionic-native/rollbar'; * - * Rollbar.init(); + * constructor(private rollbar: Rollbar) { } + * + * ... + * + * this.rollbar.init(); * * ``` */ diff --git a/src/@ionic-native/plugins/safari-view-controller/index.ts b/src/@ionic-native/plugins/safari-view-controller/index.ts index 6af178b9a..05cec83b8 100644 --- a/src/@ionic-native/plugins/safari-view-controller/index.ts +++ b/src/@ionic-native/plugins/safari-view-controller/index.ts @@ -19,13 +19,15 @@ export interface SafariViewControllerOptions { * ``` * import { SafariViewController } from '@ionic-native/safari-view-controller'; * + * constructor(private safariViewController: SafariViewController) { } * - * SafariViewController.isAvailable() - * .then( - * (available: boolean) => { - * if(available){ + * ... * - * SafariViewController.show({ + * this.safariViewController.isAvailable() + * .then((available: boolean) => { + * if (available) { + * + * this.safariViewController.show({ * url: 'http://ionic.io', * hidden: false, * animated: false, @@ -33,8 +35,7 @@ export interface SafariViewControllerOptions { * enterReaderModeIfAvailable: true, * tintColor: '#ff0000' * }) - * .then( - * (result: any) => { + * .then((result: any) => { * if(result.event === 'opened') console.log('Opened'); * else if(result.event === 'loaded') console.log('Loaded'); * else if(result.event === 'closed') console.log('Closed'); diff --git a/src/@ionic-native/plugins/screen-orientation/index.ts b/src/@ionic-native/plugins/screen-orientation/index.ts index 9f60bfed0..fd26cba42 100644 --- a/src/@ionic-native/plugins/screen-orientation/index.ts +++ b/src/@ionic-native/plugins/screen-orientation/index.ts @@ -15,12 +15,16 @@ declare var window; * ```typescript * import { ScreenOrientation } from '@ionic-native/screen-orientation'; * + * constructor(private screenOrientation: ScreenOrientation) { } + * + * ... + * * * // set to either landscape - * ScreenOrientation.lockOrientation('landscape'); + * this.screenOrientation.lockOrientation('landscape'); * * // allow user rotate - * ScreenOrientation.unlockOrientation(); + * this.screenOrientation.unlockOrientation(); * ``` * * @advanced diff --git a/src/@ionic-native/plugins/screenshot/index.ts b/src/@ionic-native/plugins/screenshot/index.ts index b5215f3b3..cb735cba4 100644 --- a/src/@ionic-native/plugins/screenshot/index.ts +++ b/src/@ionic-native/plugins/screenshot/index.ts @@ -8,13 +8,17 @@ declare var navigator: any; * @description Captures a screen shot * @usage * ```typescript - * import {Screenshot} from '@ionic-native/screenshot'; + * import { Screenshot } from '@ionic-native/screenshot'; + * + * constructor(private screenshot: Screenshot) { } + * + * ... * * // Take a screenshot and save to file - * Screenshot.save('jpg', 80, 'myscreenshot.jpg').then(onSuccess, onError); + * this.screenshot.save('jpg', 80, 'myscreenshot.jpg').then(onSuccess, onError); * * // Take a screenshot and get temporary file URI - * Screenshot.URI(80).then(onSuccess, onError); + * this.screenshot.URI(80).then(onSuccess, onError); * ``` */ @Plugin({ diff --git a/src/@ionic-native/plugins/secure-storage/index.ts b/src/@ionic-native/plugins/secure-storage/index.ts index 28978a85c..7cc99ff8c 100644 --- a/src/@ionic-native/plugins/secure-storage/index.ts +++ b/src/@ionic-native/plugins/secure-storage/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { CordovaInstance, Plugin } from '@ionic-native/core'; +import { CordovaInstance, Plugin, CordovaCheck } from '@ionic-native/core'; declare var cordova: any; @@ -53,32 +53,36 @@ export class SecureStorageObject { * @usage * * ```typescript - * import { SecureStorage } from '@ionic-native/secure-storage'; + * import { SecureStorage, SecureStorageOBject } from '@ionic-native/secure-storage'; * - * let secureStorage: SecureStorage = new SecureStorage(); - * secureStorage.create('my_store_name') - * .then( - * () => console.log('Storage is ready!'), - * error => console.log(error) - * ); + * constructor(private secureStorage: SecureStorage) { } * - * secureStorage.get('myitem') - * .then( - * data => console.log(data), - * error => console.log(error) - * ); + * ... + * + * this.secureStorage.create('my_store_name') + * .then((storage: SecureStorageObject) => { + * + * storage.get('myitem') + * .then( + * data => console.log(data), + * error => console.log(error) + * ); + * + * storage.set('myitem', 'myvalue') + * .then( + * data => console.log(data), + * error => console.log(error) + * ); + * + * storage.remove('myitem') + * .then( + * data => console.log(data), + * error => console.log(error) + * ); + * + * }); * - * secureStorage.set('myitem', 'myvalue') - * .then( - * data => console.log(data), - * error => console.log(error) - * ); * - * secureStorage.remove('myitem') - * .then( - * data => console.log(data), - * error => console.log(error) - * ); * ``` * @classes * SecureStorageObject @@ -98,6 +102,7 @@ export class SecureStorage { * @param store {string} * @returns {Promise} */ + @CordovaCheck() create(store: string): Promise { return new Promise((res, rej) => { const instance = new cordova.plugins.SecureStorage(() => res(new SecureStorageObject(instance)), rej, store); diff --git a/src/@ionic-native/plugins/serial/index.ts b/src/@ionic-native/plugins/serial/index.ts index a679e48c5..ab574424a 100644 --- a/src/@ionic-native/plugins/serial/index.ts +++ b/src/@ionic-native/plugins/serial/index.ts @@ -24,8 +24,12 @@ export interface SerialOpenOptions { * ``` * import { Serial } from '@ionic-native/serial'; * - * Serial.requestPermission().then(() => { - * Serial.open({ + * constructor(private serial: Serial) { } + * + * ... + * + * this.serial.requestPermission().then(() => { + * this.serial.open({ * baudRate: 9800 * }).then(() => { * console.log('Serial connection opened'); diff --git a/src/@ionic-native/plugins/shake/index.ts b/src/@ionic-native/plugins/shake/index.ts index 24eac895e..a169c8796 100644 --- a/src/@ionic-native/plugins/shake/index.ts +++ b/src/@ionic-native/plugins/shake/index.ts @@ -6,9 +6,13 @@ import { Observable } from 'rxjs/Observable'; * @description Handles shake gesture * @usage * ```typescript - * import {Shake} from '@ionic-native/shake'; + * import { Shake } from '@ionic-native/shake'; * - * let watch = Shake.startWatch(60).subscribe(() => { + * constructor(private shake: Shake) { } + * + * ... + * + * const watch = this.shake.startWatch(60).subscribe(() => { * // do something * }); * diff --git a/src/@ionic-native/plugins/sim/index.ts b/src/@ionic-native/plugins/sim/index.ts index 45006de8f..dc3c5b985 100644 --- a/src/@ionic-native/plugins/sim/index.ts +++ b/src/@ionic-native/plugins/sim/index.ts @@ -14,16 +14,20 @@ import { Cordova, Plugin } from '@ionic-native/core'; * import { Sim } from '@ionic-native/sim'; * * - * Sim.getSimInfo().then( + * constructor(private sim: Sim) { } + * + * ... + * + * this.sim.getSimInfo().then( * (info) => console.log('Sim info: ', info), * (err) => console.log('Unable to get sim info: ', err) * ); * - * Sim.hasReadPermission().then( + * this.sim.hasReadPermission().then( * (info) => console.log('Has permission: ', info) * ); * - * Sim.requestReadPermission().then( + * this.sim.requestReadPermission().then( * () => console.log('Permission granted'), * () => console.log('Permission denied') * ); diff --git a/src/@ionic-native/plugins/sms/index.ts b/src/@ionic-native/plugins/sms/index.ts index 4236a558d..a0e804c30 100644 --- a/src/@ionic-native/plugins/sms/index.ts +++ b/src/@ionic-native/plugins/sms/index.ts @@ -35,9 +35,14 @@ export interface SmsOptionsAndroid { * ```typescript * import { SMS } from '@ionic-native/sms'; * + * constructor(private sms: SMS) { } + * + * + * ... + * * * // Send a text message using default options - * SMS.send('416123456', 'Hello world!'); + * this.sms.send('416123456', 'Hello world!'); * ``` * @interfaces * SmsOptions diff --git a/src/@ionic-native/plugins/social-sharing/index.ts b/src/@ionic-native/plugins/social-sharing/index.ts index 1db428efc..87bb696fd 100644 --- a/src/@ionic-native/plugins/social-sharing/index.ts +++ b/src/@ionic-native/plugins/social-sharing/index.ts @@ -10,15 +10,19 @@ import { Cordova, Plugin } from '@ionic-native/core'; * ```typescript * import { SocialSharing } from '@ionic-native/social-sharing'; * + * constructor(private socialSharing: SocialSharing) { } + * + * ... + * * // Check if sharing via email is supported - * SocialSharing.canShareViaEmail().then(() => { + * this.socialSharing.canShareViaEmail().then(() => { * // Sharing via email is possible * }).catch(() => { * // Sharing via email is not possible * }); * * // Share via email - * SocialSharing.shareViaEmail('Body', 'Subject', 'recipient@example.org').then(() => { + * this.socialSharing.shareViaEmail('Body', 'Subject', 'recipient@example.org').then(() => { * // Success! * }).catch(() => { * // Error! diff --git a/src/@ionic-native/plugins/speech-recognition/index.ts b/src/@ionic-native/plugins/speech-recognition/index.ts index 7119dbaf3..f65e7a1c4 100644 --- a/src/@ionic-native/plugins/speech-recognition/index.ts +++ b/src/@ionic-native/plugins/speech-recognition/index.ts @@ -53,33 +53,39 @@ export interface SpeechRecognitionListeningOptionsAndroid { * ``` * import { SpeechRecognition } from '@ionic-native/speech-recognition'; * + * constructor(private speechRecognition: SpeechRecognition) { } + * + * ... + * + * + * * // Check feature available - * SpeechRecognition.isRecognitionAvailable() + * this.speechRecognition.isRecognitionAvailable() * .then((available: boolean) => console.log(available)) * * // Start the recognition process - * SpeechRecognition.startListening(options) + * this.speechRecognition.startListening(options) * .subscribe( * (matches: Array) => console.log(matches), * (onerror) => console.log('error:', onerror) * ) * * // Stop the recognition process (iOS only) - * SpeechRecognition.stopListening() + * this.speechRecognition.stopListening() * * // Get the list of supported languages - * SpeechRecognition.getSupportedLanguages() + * this.speechRecognition.getSupportedLanguages() * .then( * (languages: Array) => console.log(languages), * (error) => console.log(error) * ) * * // Check permission - * SpeechRecognition.hasPermission() + * this.speechRecognition.hasPermission() * .then((hasPermission: boolean) => console.log(hasPermission)) * * // Request permissions - * SpeechRecognition.requestPermission() + * this.speechRecognition.requestPermission() * .then( * () => console.log('Granted'), * () => console.log('Denied') diff --git a/src/@ionic-native/plugins/spinner-dialog/index.ts b/src/@ionic-native/plugins/spinner-dialog/index.ts index c5c21c606..c6847e5a1 100644 --- a/src/@ionic-native/plugins/spinner-dialog/index.ts +++ b/src/@ionic-native/plugins/spinner-dialog/index.ts @@ -15,10 +15,13 @@ export interface SpinnerDialogIOSOptions { * ```typescript * import { SpinnerDialog } from '@ionic-native/spinner-dialog'; * + * constructor(private spinnerDialog: SpinnerDialog) { } * - * SpinnerDialog.show(); + * ... * - * SpinnerDialog.hide(); + * this.spinnerDialog.show(); + * + * this.spinnerDialog.hide(); * ``` * @interfaces * SpinnerDialogIOSOptions diff --git a/src/@ionic-native/plugins/splash-screen/index.ts b/src/@ionic-native/plugins/splash-screen/index.ts index 55ac5ddcb..9722ad6c5 100644 --- a/src/@ionic-native/plugins/splash-screen/index.ts +++ b/src/@ionic-native/plugins/splash-screen/index.ts @@ -9,10 +9,13 @@ import { Cordova, Plugin } from '@ionic-native/core'; * ```typescript * import { SplashScreen } from '@ionic-native/splash-screen'; * + * constructor(private splashScreen: SplashScreen) { } * - * Splashscreen.show(); + * ... * - * Splashscreen.hide(); + * this.splashScreen.show(); + * + * this.splashScreen.hide(); * ``` */ @Plugin({ diff --git a/src/@ionic-native/plugins/sqlite/index.ts b/src/@ionic-native/plugins/sqlite/index.ts index fcd0e99b5..bde9b4e22 100644 --- a/src/@ionic-native/plugins/sqlite/index.ts +++ b/src/@ionic-native/plugins/sqlite/index.ts @@ -148,35 +148,27 @@ export class SQLiteObject { * @usage * * ```typescript - * import { SQLite } from '@ionic-native/sqlite'; + * import { SQLite, SQLiteObject } from '@ionic-native/sqlite'; * - * // OPTION A: Use static constructor - * SQLite.openDatabase({ + * constructor(private sqlite: SQLite) { } + * + * ... + * + * this.sqlite.create({ * name: 'data.db', * location: 'default' * }) - * .then((db: SQLite) => { + * .then((db: SQLiteObject) => { + * + * + * db.executeSql('create table danceMoves(name VARCHAR(32))', {}) + * .then(() => console.log('Executed SQL')) + * .catch(e => console.log(e)); * - * db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {}).catch(() => {}); * * }) - * .catch(error => console.error('Error opening database', error); + * .catch(e => console.log(e)); * - * - * // OPTION B: Create a new instance of SQLite - * let db = new SQLite(); - * db.openDatabase({ - * name: 'data.db', - * location: 'default' // the location field is required - * }).then(() => { - * db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => { - * - * }, (err) => { - * console.error('Unable to execute sql: ', err); - * }); - * }, (err) => { - * console.error('Unable to open database: ', err); - * }); * ``` * * @classes diff --git a/src/@ionic-native/plugins/status-bar/index.ts b/src/@ionic-native/plugins/status-bar/index.ts index 724e3082c..a3f80d9cf 100644 --- a/src/@ionic-native/plugins/status-bar/index.ts +++ b/src/@ionic-native/plugins/status-bar/index.ts @@ -15,10 +15,14 @@ declare var window; * ```typescript * import { StatusBar } from '@ionic-native/status-bar'; * + * constructor(private statusBar: StatusBar) { } * - * StatusBar.overlaysWebView(true); // let status bar overlay webview + * ... * - * StatusBar.backgroundColorByHexString('#ffffff'); // set status bar to white + * + * this.statusBar.overlaysWebView(true); // let status bar overlay webview + * + * this.statusBar.backgroundColorByHexString('#ffffff'); // set status bar to white * ``` * */ diff --git a/src/@ionic-native/plugins/stepcounter/index.ts b/src/@ionic-native/plugins/stepcounter/index.ts index f18235fe2..d524fa8a6 100644 --- a/src/@ionic-native/plugins/stepcounter/index.ts +++ b/src/@ionic-native/plugins/stepcounter/index.ts @@ -13,10 +13,14 @@ import { Plugin, Cordova } from '@ionic-native/core'; * ``` * import { Stepcounter } from '@ionic-native/stepcounter'; * - * let startingOffset = 0; - * Stepcounter.start(startingOffset).then(onSuccess => console.log('stepcounter-start success', onSuccess), onFailure => console.log('stepcounter-start error', onFailure)); + * constructor(private stepcounter: Stepcounter) { } * - * Stepcounter.getHistory().then(historyObj => console.log('stepcounter-history success', historyObj), onFailure => console.log('stepcounter-history error', onFailure)); + * ... + * + * let startingOffset = 0; + * this.stepcounter.start(startingOffset).then(onSuccess => console.log('stepcounter-start success', onSuccess), onFailure => console.log('stepcounter-start error', onFailure)); + * + * this.stepcounter.getHistory().then(historyObj => console.log('stepcounter-history success', historyObj), onFailure => console.log('stepcounter-history error', onFailure)); * * ``` */ diff --git a/src/@ionic-native/plugins/streaming-media/index.ts b/src/@ionic-native/plugins/streaming-media/index.ts index c61991538..db63b87ba 100644 --- a/src/@ionic-native/plugins/streaming-media/index.ts +++ b/src/@ionic-native/plugins/streaming-media/index.ts @@ -23,7 +23,9 @@ export interface StreamingAudioOptions { * * @usage * ``` - * import {StreamingMedia, StreamingVideoOptions} from '@ionic-native/streaming-media'; + * import { StreamingMedia, StreamingVideoOptions } from '@ionic-native/streaming-media'; + * + * constructor(private streamingMedia: StreamingMedia) { } * * let options: StreamingVideoOptions = { * successCallback: () => { console.log('Video played') }, @@ -31,7 +33,7 @@ export interface StreamingAudioOptions { * orientation: 'landscape' * }; * - * StreamingMedia.playVideo('https://path/to/video/stream', options); + * this.streamingMedia.playVideo('https://path/to/video/stream', options); * * ``` * @interfaces diff --git a/src/@ionic-native/plugins/stripe/index.ts b/src/@ionic-native/plugins/stripe/index.ts index d94f61fca..1aec9d420 100644 --- a/src/@ionic-native/plugins/stripe/index.ts +++ b/src/@ionic-native/plugins/stripe/index.ts @@ -61,7 +61,11 @@ export interface StripeCardTokenParams { * ``` * import { Stripe } from '@ionic-native/stripe'; * - * Stripe.setPublishableKey('my_publishable_key'); + * constructor(private stripe: Stripe) { } + * + * ... + * + * this.stripe.setPublishableKey('my_publishable_key'); * * let card = { * number: '4242424242424242', @@ -70,7 +74,7 @@ export interface StripeCardTokenParams { * cvc: '220' * }; * - * Stripe.createCardToken(card) + * this.stripe.createCardToken(card) * .then(token => console.log(token)) * .catch(error => console.error(error)); * diff --git a/src/@ionic-native/plugins/text-to-speech/index.ts b/src/@ionic-native/plugins/text-to-speech/index.ts index 7eca15470..7a4947b16 100644 --- a/src/@ionic-native/plugins/text-to-speech/index.ts +++ b/src/@ionic-native/plugins/text-to-speech/index.ts @@ -17,9 +17,13 @@ export interface TTSOptions { * * @usage * ``` - * import {TextToSpeech} from '@ionic-native/text-to-speech'; + * import { TextToSpeech } from '@ionic-native/text-to-speech'; * - * TextToSpeech.speak('Hello World') + * constructor(private tts: TextToSpeech) { } + * + * ... + * + * this.tts.speak('Hello World') * .then(() => console.log('Success')) * .catch((reason: any) => console.log(reason)); * diff --git a/src/@ionic-native/plugins/themeable-browser/index.ts b/src/@ionic-native/plugins/themeable-browser/index.ts index 2f4c123ed..ea610fefa 100644 --- a/src/@ionic-native/plugins/themeable-browser/index.ts +++ b/src/@ionic-native/plugins/themeable-browser/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Plugin, CordovaInstance } from '@ionic-native/core'; +import { Plugin, CordovaInstance, InstanceCheck } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; declare var cordova: any; @@ -124,6 +124,7 @@ export class ThemeableBrowserObject { * @param event Event name * @returns {Observable} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe. */ + @InstanceCheck({ observable: true }) on(event: string): Observable { return new Observable((observer) => { this._objectInstance.addEventListener(event, observer.next.bind(observer)); @@ -140,13 +141,17 @@ export class ThemeableBrowserObject { * * @usage * ``` - * import { ThemeableBrowser } from '@ionic-native/themeable-browser'; + * import { ThemeableBrowser, ThemeableBrowserOptions, ThemeableBrowserObject } from '@ionic-native/themeable-browser'; + * + * constructor(private themeableBrowser: ThemeableBrowser) { } + * + * ... * * // can add options from the original InAppBrowser in a JavaScript object form (not string) * // This options object also takes additional parameters introduced by the ThemeableBrowser plugin * // This example only shows the additional parameters for ThemeableBrowser * // Note that that `image` and `imagePressed` values refer to resources that are stored in your app - * let options = { + * const options: ThemeableBrowserOptions = { * statusbar: { * color: '#ffffffff' * }, @@ -204,7 +209,7 @@ export class ThemeableBrowserObject { * backButtonCanClose: true * }; * - * let browser = new ThemeableBrowser('https://ionic.io', '_blank', options); + * const browser: ThemeableBrowserObject = this.themeableBrowser.create('https://ionic.io', '_blank', options); * * ``` * We suggest that you refer to the plugin's repository for additional information on usage that may not be covered here. diff --git a/src/@ionic-native/plugins/three-dee-touch/index.ts b/src/@ionic-native/plugins/three-dee-touch/index.ts index 49e25cb0b..7268f07fa 100644 --- a/src/@ionic-native/plugins/three-dee-touch/index.ts +++ b/src/@ionic-native/plugins/three-dee-touch/index.ts @@ -59,20 +59,20 @@ export interface ThreeDeeTouchForceTouch { } /** - * @name 3DTouch + * @name 3D Touch * @description * @usage * Please do refer to the original plugin's repo for detailed usage. The usage example here might not be sufficient. * ``` - * import { ThreeDeeTiouch } from '@ionic-native/three-dee-touch'; + * import { ThreeDeeTouch, ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch } from '@ionic-native/three-dee-touch'; + * + * constructor(private threeDeeTouch: ThreeDeeTouch) { } * - * // import for type completion on variables - * import { ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch } from '@ionic-native/3dtouch'; * ... * - * ThreeDeeTouch.isAvailable().then(isAvailable => console.log("3D Touch available? " + isAvailable)); + * this.threeDeeTouch.isAvailable().then(isAvailable => console.log("3D Touch available? " + isAvailable)); * - * ThreeDeeTouch.watchForceTouches() + * this.threeDeeTouch.watchForceTouches() * .subscribe( * (data: ThreeDeeTouchForceTouch) => { * console.log("Force touch %" + data.force); @@ -106,9 +106,10 @@ export interface ThreeDeeTouchForceTouch { * iconTemplate: 'HeartTemplate' * } * ]; - * ThreeDeeTouch.configureQuickActions(actions); * - * ThreeDeeTouch.onHomeIconPressed().subscribe( + * this.threeDeeTouch.configureQuickActions(actions); + * + * this.threeDeeTouch.onHomeIconPressed().subscribe( * (payload) => { * // returns an object that is the button you presed * console.log('Pressed the ${payload.title} button') diff --git a/src/@ionic-native/plugins/toast/index.ts b/src/@ionic-native/plugins/toast/index.ts index 78dc3b560..359016976 100644 --- a/src/@ionic-native/plugins/toast/index.ts +++ b/src/@ionic-native/plugins/toast/index.ts @@ -47,8 +47,11 @@ export interface ToastOptions { * ```typescript * import { Toast } from '@ionic-native/toast'; * + * constructor(private toast: Toast) { } * - * Toast.show("I'm a toast", '5000', 'center').subscribe( + * ... + * + * thisoast.show("I'm a toast", '5000', 'center').subscribe( * toast => { * console.log(toast); * } @@ -79,11 +82,7 @@ export class Toast { observable: true, clearFunction: 'hide' }) - show( - message: string, - duration: string, - position: string - ): Observable { return; } + show(message: string, duration: string, position: string): Observable { return; } /** * Manually hide any currently visible toast. diff --git a/src/@ionic-native/plugins/touch-id/index.ts b/src/@ionic-native/plugins/touch-id/index.ts index 9f6b8806b..7d8c5f6ac 100644 --- a/src/@ionic-native/plugins/touch-id/index.ts +++ b/src/@ionic-native/plugins/touch-id/index.ts @@ -10,22 +10,20 @@ import { Cordova, Plugin } from '@ionic-native/core'; * Requires Cordova plugin: `cordova-plugin-touch-id`. For more info, please see the [TouchID plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-touch-id). * * @usage - * ### Import Touch ID Plugin into Project * ```typescript * import { TouchID } from '@ionic-native/touch-id'; - * ``` - * ### Check for Touch ID Availability - * ```typescript - * TouchID.isAvailable() + * + * constructor(private touchId: TouchID) { } + * + * ... + * + * this.touchId.isAvailable() * .then( * res => console.log('TouchID is available!'), * err => console.error('TouchID is not available', err) * ); - * ``` - * ### Invoke Touch ID w/ Custom Message * - * ```typescript - * TouchID.verifyFingerprint('Scan your fingerprint please') + * this.touchId.verifyFingerprint('Scan your fingerprint please') * .then( * res => console.log('Ok', res), * err => console.error('Error', err) diff --git a/src/@ionic-native/plugins/transfer/index.ts b/src/@ionic-native/plugins/transfer/index.ts index 70a7692c9..32b836251 100644 --- a/src/@ionic-native/plugins/transfer/index.ts +++ b/src/@ionic-native/plugins/transfer/index.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { CordovaInstance, Plugin } from '@ionic-native/core'; +import { CordovaInstance, Plugin, InstanceCheck, checkAvailability } from '@ionic-native/core'; declare var FileTransfer; @@ -116,48 +116,42 @@ export interface FileTransferError { * * @usage * ```typescript - * import { Transfer } from '@ionic-native/transfer'; + * import { Transfer, FileUploadOptions } from '@ionic-native/transfer'; + * import { File } from '@ionic-native/file'; * + * constructor(private transfer: Transfer, private file: File) { } * - * // Create instance: - * const fileTransfer = new Transfer(); + * ... * * // Upload a file: - * fileTransfer.upload(..).then(..).catch(..); + * this.transfer.upload(..).then(..).catch(..); * * // Download a file: - * fileTransfer.download(..).then(..).catch(..); + * this.transfer.download(..).then(..).catch(..); * * // Abort active transfer: - * fileTransfer.abort(); + * this.transfer.abort(); * - * E.g - * - * upload(){ - * const fileTransfer = new Transfer(); - * var options: any; - * - * options = { + * // full example + * upload() { + * let options: FileUploadOptions = { * fileKey: 'file', * fileName: 'name.jpg', * headers: {} * ..... * } - * fileTransfer.upload("", "", options) + * + * this.transfer.upload("", "", options) * .then((data) => { * // success * }, (err) => { * // error * }) * } - * - * // Cordova - * declare var cordova: any; - * + ** * download() { - * const fileTransfer = new Transfer(); * let url = 'http://www.example.com/file.pdf'; - * fileTransfer.download(url, cordova.file.dataDirectory + 'file.pdf').then((entry) => { + * this.transfer.download(url, this.file.dataDirectory + 'file.pdf').then((entry) => { * console.log('download complete: ' + entry.toURL()); * }, (error) => { * // handle error @@ -166,15 +160,6 @@ export interface FileTransferError { * * ``` * - * Note: You will not see your documents using a file explorer on your device. Use adb: - * - * ``` - * adb shell - * run-as com.your.app - * cd files - * ls - * ``` - * * To store files in a different/publicly accessible directory, please refer to the following link * https://github.com/apache/cordova-plugin-file#where-to-store-files * @@ -213,7 +198,9 @@ export class Transfer { private _objectInstance: any; constructor() { - this._objectInstance = new FileTransfer(); + if (checkAvailability('FileTransfer', null, 'FileTransfer') === true) { + this._objectInstance = new FileTransfer(); + } } /** @@ -254,6 +241,7 @@ export class Transfer { * Registers a listener that gets called whenever a new chunk of data is transferred. * @param listener {function} Listener that takes a progress event. */ + @InstanceCheck({ sync: true }) onProgress(listener: (event: ProgressEvent) => any): void { this._objectInstance.onprogress = listener; } diff --git a/src/@ionic-native/plugins/twitter-connect/index.ts b/src/@ionic-native/plugins/twitter-connect/index.ts index 13cfcbe8c..653e8e662 100644 --- a/src/@ionic-native/plugins/twitter-connect/index.ts +++ b/src/@ionic-native/plugins/twitter-connect/index.ts @@ -26,7 +26,11 @@ export interface TwitterConnectResponse { * Plugin to use Twitter Single Sign On * Uses Twitter's Fabric SDK * ```typescript - * import {TwitterConnect} from '@ionic-native/twitter-connect'; + * import { TwitterConnect } from '@ionic-native/twitter-connect'; + * + * constructor(private twitter: TwitterConnect) { } + * + * ... * * function onSuccess(response) { * console.log(response); @@ -40,9 +44,9 @@ export interface TwitterConnectResponse { * // } * } * - * TwitterConnect.login().then(onSuccess, onError); + * this.twitter.login().then(onSuccess, onError); * - * TwitterConnect.logout().then(onLogoutSuccess, onLogoutError); + * this.twitter.logout().then(onLogoutSuccess, onLogoutError); * ``` * @interfaces * TwitterConnectResponse diff --git a/src/@ionic-native/plugins/vibration/index.ts b/src/@ionic-native/plugins/vibration/index.ts index 624cedaf8..354910869 100644 --- a/src/@ionic-native/plugins/vibration/index.ts +++ b/src/@ionic-native/plugins/vibration/index.ts @@ -9,20 +9,23 @@ import { Cordova, Plugin } from '@ionic-native/core'; * ```typescript * import { Vibration } from '@ionic-native/vibration'; * + * constructor(private vibration: Vibration) { } + * + * ... * * // Vibrate the device for a second * // Duration is ignored on iOS. - * Vibration.vibrate(1000); + * this.vibration.vibrate(1000); * * // Vibrate 2 seconds * // Pause for 1 second * // Vibrate for 2 seconds * // Patterns work on Android and Windows only - * Vibration.vibrate([2000,1000,2000]); + * this.vibration.vibrate([2000,1000,2000]); * * // Stop any current vibrations immediately * // Works on Android and Windows only - * Vibration.vibrate(0); + * this.vibration.vibrate(0); * ``` */ @Plugin({ diff --git a/src/@ionic-native/plugins/video-editor/index.ts b/src/@ionic-native/plugins/video-editor/index.ts index dc70a1f90..8f0e507f7 100644 --- a/src/@ionic-native/plugins/video-editor/index.ts +++ b/src/@ionic-native/plugins/video-editor/index.ts @@ -125,9 +125,13 @@ export interface VideoInfo { * * @usage * ``` - * import {VideoEditor} from '@ionic-native/video-editor'; + * import { VideoEditor } from '@ionic-native/video-editor'; * - * VideoEditor.transcodeVideo({ + * constructor(private videoEditor: VideoEditor) { } + * + * ... + * + * this.videoEditor.transcodeVideo({ * fileUri: '/path/to/input.mov', * outputFileName: 'output.mp4', * outputFileType: VideoEditor.OutputFileType.MPEG4 diff --git a/src/@ionic-native/plugins/video-player/index.ts b/src/@ionic-native/plugins/video-player/index.ts index 0e7c6c7bd..74c3a31a8 100644 --- a/src/@ionic-native/plugins/video-player/index.ts +++ b/src/@ionic-native/plugins/video-player/index.ts @@ -28,9 +28,12 @@ export interface VideoOptions { * ```typescript * import { VideoPlayer } from '@ionic-native/video-player; * + * constructor(private videoPlayer: VideoPlayer) { } + * + * ... * * // Playing a video. - * VideoPlayer.play("file:///android_asset/www/movie.mp4").then(() => { + * this.videoPlayer.play("file:///android_asset/www/movie.mp4").then(() => { * console.log('video completed'); * }).catch(err => { * console.log(err); diff --git a/src/@ionic-native/plugins/web-intent/index.ts b/src/@ionic-native/plugins/web-intent/index.ts index 8bcab852e..19f9f2a3b 100644 --- a/src/@ionic-native/plugins/web-intent/index.ts +++ b/src/@ionic-native/plugins/web-intent/index.ts @@ -11,9 +11,13 @@ declare var window; * For usage information please refer to the plugin's Github repo. * * ```typescript - * import {WebIntent} from '@ionic-native/web-intent'; + * import { WebIntent } from '@ionic-native/web-intent'; * - * WebIntent.startActivity(options).then(onSuccess, onError); + * constructor(private webIntent: WebIntent) { } + * + * ... + * + * this.webIntent.startActivity(options).then(onSuccess, onError); * * ``` */ diff --git a/src/@ionic-native/plugins/youtube-video-player/index.ts b/src/@ionic-native/plugins/youtube-video-player/index.ts index 748137459..2b62ab485 100644 --- a/src/@ionic-native/plugins/youtube-video-player/index.ts +++ b/src/@ionic-native/plugins/youtube-video-player/index.ts @@ -7,9 +7,14 @@ import { Plugin, Cordova } from '@ionic-native/core'; * * @usage * ``` - * import {YoutubeVideoPlayer} from '@ionic-native/youtube-video-player'; + * import { YoutubeVideoPlayer } from '@ionic-native/youtube-video-player'; * - * YoutubeVideoPlayer.openVideo('myvideoid'); + * constructor(private youtube: YoutubeVideoPlayer) { } + * + * ... + * + * + * this.youtube.openVideo('myvideoid'); * * ``` */ diff --git a/src/@ionic-native/plugins/z-bar/index.ts b/src/@ionic-native/plugins/z-bar/index.ts index cb23d6535..5ac42e8fd 100644 --- a/src/@ionic-native/plugins/z-bar/index.ts +++ b/src/@ionic-native/plugins/z-bar/index.ts @@ -44,14 +44,18 @@ export interface ZBarOptions { * * @usage * ``` - * import { ZBar } from '@ionic-native/z-bar'; + * import { ZBar, ZBarOptions } from '@ionic-native/z-bar'; * - * let zBarOptions = { + * constructor(private zbar: ZBar) { } + * + * ... + * + * let ZBarOptions = { * flash: "off", * drawSight: false * }; * - * ZBar.scan(zBarOptions) + * this.zbar.scan(zBarOptions) * .then(result => { * console.log(result); // Scanned code * }) diff --git a/src/@ionic-native/plugins/zip/index.ts b/src/@ionic-native/plugins/zip/index.ts index b70d307aa..50489ce2a 100644 --- a/src/@ionic-native/plugins/zip/index.ts +++ b/src/@ionic-native/plugins/zip/index.ts @@ -8,9 +8,13 @@ import { Plugin, Cordova } from '@ionic-native/core'; * * @usage * ``` - * import {Zip} from '@ionic-native/zip'; + * import { Zip } from '@ionic-native/zip'; * - * Zip.unzip('path/to/source.zip', 'path/to/dest', (progress) => console.log('Unzipping, ' + Math.round((progress.loaded / progress.total) * 100) + '%')) + * constructor(private zip: Zip) { } + * + * ... + * + * this.zip.unzip('path/to/source.zip', 'path/to/dest', (progress) => console.log('Unzipping, ' + Math.round((progress.loaded / progress.total) * 100) + '%')) * .then((result) => { * if(result === 0) console.log('SUCCESS'); * if(result === -1) console.log('FAILED');