Improvements on documentation (#340)

* Improvements on documentation and some refactor

* ts | js -> typescript (docs)
This commit is contained in:
Guillermo 2016-07-20 17:17:09 +02:00 committed by Ibrahim Hadeed
parent d4d30ab9c9
commit 7952f9ef60
65 changed files with 281 additions and 279 deletions

View File

@ -17,7 +17,7 @@ For the full Ionic Native documentation, please visit [http://ionicframework.com
Ionic Native wraps plugin callbacks in a Promise or [Observable](https://gist.github.com/staltz/868e7e9bc2a7b8c1f754), providing a common interface for all plugins and ensuring that native events trigger change detection in Angular 2.
```
import {Geolocation} from 'ionic-native';
import { Geolocation } from 'ionic-native';
Geolocation.getCurrentPosition().then(pos => {
console.log('lat: ' + pos.coords.latitude + ', lon: ' + pos.coords.longitude);

View File

@ -10,13 +10,13 @@ declare var window: any;
* @usage
* Please do refer to the original plugin's repo for detailed usage. The usage example here might not be sufficient.
* ```
* import {ThreeDeeTouch} from 'ionic-native';
* import { ThreeDeeTouch } from 'ionic-native';
*
* // import for type completion on variables
* import {ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch} from 'ionic-native';
* import { ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch } from 'ionic-native';
* ...
*
* ThreeDeeTouch.isAvailable().then(isAvailable => console.log("3D Touch available? " + isAvailable)):
* ThreeDeeTouch.isAvailable().then(isAvailable => console.log("3D Touch available? " + isAvailable));
*
* ThreeDeeTouch.watchForceTouches()
* .subscribe(
@ -57,7 +57,7 @@ declare var window: any;
* ThreeDeeTouchForceTouch.onHomeIconPressed().subscribe(
* (payload) => {
* // returns an object that is the button you presed
* console.log(`Pressed the ${payload.title} button`)
* console.log('Pressed the ${payload.title} button')
* console.log(payload.type)
*
* }
@ -130,13 +130,16 @@ export class ThreeDeeTouch {
sync: true
})
static disableLinkPreview(): void { }
}
export interface ThreeDeeTouchQuickAction {
type?: string;
title: string;
subtitle?: string;
iconType?: string;
}
export interface ThreeDeeTouchForceTouch {
force: number;
timestamp: number;

View File

@ -9,8 +9,9 @@ import { Cordova, Plugin } from './plugin';
* Requires Cordova plugin: `cordova-plugin-actionsheet`. For more info, please see the [ActionSheet plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-actionsheet).
*
* @usage
* ```ts
* import {ActionSheet} from 'ionic-native';
* ```typescript
* import { ActionSheet } from 'ionic-native';
*
*
* let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
* ActionSheet.show({
@ -18,7 +19,7 @@ import { Cordova, Plugin } from './plugin';
* 'buttonLabels': buttonLabels,
* 'addCancelButtonWithLabel': 'Cancel',
* 'addDestructiveButtonWithLabel' : 'Delete'
* }).then(buttonIndex => {
* }).then((buttonIndex: number) => {
* console.log('Button pressed: ' + buttonLabels[buttonIndex - 1]);
* });
* ```
@ -72,4 +73,5 @@ export class ActionSheet {
*/
@Cordova()
static hide(options?: any): Promise<any> { return; }
}

View File

@ -8,22 +8,22 @@ import { Cordova, Plugin } from './plugin';
* Requires Cordova plugin: cordova-plugin-appavailability. For more info, please see the [AppAvailability plugin docs](https://github.com/ohh2ahh/AppAvailability).
*
* @usage
* ```js
* import {AppAvailability} from 'ionic-native';
* ```typescript
* import { AppAvailability } from 'ionic-native';
*
*
* var app;
* let app;
*
* if(device.platform === 'iOS') {
* if (device.platform === 'iOS') {
* app = 'twitter://';
* }else if(device.platform === 'Android'){
* } else if (device.platform === 'Android') {
* app = 'com.twitter.android';
* }
*
* AppAvailability.check(app)
* .then(
* yes => console.log(app + " is available"),
* no => console.log(app + " is NOT available")
* (yes: string) => console.log(app + ' is available'),
* (no: string) => console.log(app + ' is NOT available')
* );
* ```
*/

View File

@ -11,8 +11,8 @@ declare var window;
* Requires Cordova plugin: cordova-plugin-apprate. For more info, please see the [AppRate plugin docs](https://github.com/pushandplay/cordova-plugin-apprate).
*
* @usage
* ```js
* import {AppRate} from 'ionic-native';
* ```typescript
* import { AppRate } from 'ionic-native';
*
*
* AppRate.preferences.storeAppURL.ios = '<my_app_id>';

View File

@ -8,8 +8,8 @@ import { Cordova, Plugin } from './plugin';
* Requires Cordova plugin: `cordova-plugin-app-version`. For more info, please see the [Cordova App Version docs](https://github.com/whiteoctober/cordova-plugin-app-version).
*
* @usage
* ```js
* import {AppVersion} from 'ionic-native';
* ```typescript
* import { AppVersion } from 'ionic-native';
*
*
* AppVersion.getAppName();

View File

@ -162,9 +162,8 @@ export interface Config {
*
* @usage
*
* ```ts
* import {BackgroundGeolocation} from 'ionic-native';
*
* ```typescript
* import { BackgroundGeolocation } from 'ionic-native';
*
*
* // When device is ready :

View File

@ -6,8 +6,8 @@ import { Cordova, Plugin } from './plugin';
* Cordova plugin to prevent the app from going to sleep while in background.
* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode#android-customization
*@usage
* ```js
* import {BackgroundMode} from 'ionic-native';
* ```typescript
* import { BackgroundMode } from 'ionic-native';
*
* BackgroundMode.enable();
* ```
@ -91,6 +91,7 @@ export class BackgroundMode {
sync: true
})
static on(eventName: string, callback: any): void { }
}
/**

View File

@ -8,8 +8,8 @@ import { Cordova, Plugin } from './plugin';
* Requires Cordova plugin: cordova-plugin-badge. For more info, please see the [Badge plugin docs](https://github.com/katzer/cordova-plugin-badge).
*
* @usage
* ```js
* import {Badge} from 'ionic-native';
* ```typescript
* import { Badge } from 'ionic-native';
*
*
* Badge.set(10);
@ -74,4 +74,5 @@ export class Badge {
*/
@Cordova()
static registerPermission(): Promise<any> { return; }
}

View File

@ -8,8 +8,8 @@ import { Cordova, Plugin } from './plugin';
* Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BarcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner).
*
* @usage
* ```js
* import {BarcodeScanner} from 'ionic-native';
* ```typescript
* import { BarcodeScanner } from 'ionic-native';
*
*
* BarcodeScanner.scan().then((barcodeData) => {

View File

@ -3,13 +3,13 @@ import { Cordova, Plugin } from './plugin';
* @name Base64 To Gallery
* @description This plugin allows you to save base64 data as a png image into the device
* @usage
* ```ts
* import {Base64ToGallery} from 'ionic-native';
* ```typescript
* import { Base64ToGallery } from 'ionic-native';
*
*
* Base64ToGallery.base64ToGallery(base64Data, 'img_').then(
* res => console.log("Saved image to gallery ", res),
* err => console.log("Error saving image to gallery ", err)
* res => console.log('Saved image to gallery ', res),
* err => console.log('Error saving image to gallery ', err)
* );
* ```
*/

View File

@ -7,14 +7,13 @@ import { Observable } from 'rxjs/Observable';
* Requires Cordova plugin: cordova-plugin-batterystatus. For more info, please see the [BatteryStatus plugin docs](https://github.com/apache/cordova-plugin-battery-status).
*
* @usage
* ```js
* import {BatteryStatus} from 'ionic-native';
*
* ```typescript
* import { BatteryStatus } from 'ionic-native';
*
*
* // watch change in battery status
* let subscription = BatteryStatus.onChange().subscribe(
* status => {
* (status: StatusObject) => {
* console.log(status.level, status.isPlugged);
* }
* );

View File

@ -24,7 +24,7 @@ import { Observable } from 'rxjs/Observable';
*
* Peripheral Data is passed to the success callback when scanning and connecting. Limited data is passed when scanning.
*
* ```ts
* ```typescript
* {
* "name": "Battery Demo",
* "id": "20:FF:D0:FF:D1:C0",
@ -34,7 +34,7 @@ import { Observable } from 'rxjs/Observable';
* ```
* After connecting, the peripheral object also includes service, characteristic and descriptor information.
*
* ```ts
* ```typescript
* {
* "name": "Battery Demo",
* "id": "20:FF:D0:FF:D1:C0",
@ -93,7 +93,7 @@ import { Observable } from 'rxjs/Observable';
*
* ### Android
*
* ```ts
* ```typescript
* {
* "name": "demo",
* "id": "00:1A:7D:DA:71:13",
@ -108,7 +108,7 @@ import { Observable } from 'rxjs/Observable';
*
* Note that iOS uses the string value of the constants for the [Advertisement Data Retrieval Keys](https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CBCentralManagerDelegate_Protocol/index.html#//apple_ref/doc/constant_group/Advertisement_Data_Retrieval_Keys). This will likely change in the future.
*
* ```ts
* ```typescript
* {
* "name": "demo",
* "id": "D8479A4F-7517-BCD3-91B5-3302B2F81802",
@ -137,7 +137,7 @@ import { Observable } from 'rxjs/Observable';
*
* This means that you need convert your data to ArrayBuffers before sending and from ArrayBuffers when receiving.
*
* ```ts
* ```typescript
* // ASCII only
* function stringToBytes(string) {
* var array = new Uint8Array(string.length);

View File

@ -5,12 +5,15 @@ import { Observable } from 'rxjs/Observable';
* @name Bluetooth Serial
* @description This plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino.
* @usage
* ```ts
* ```typescript
* import { BluetoothSerial } from 'ionic-native';
*
*
* // Write a string
* Bluetooth.write("hello world").then(success, failure);
* BluetoothSerial.write("hello world").then(success, failure);
*
* // Array of int or bytes
* Bluetooth.write([186, 220, 222]).then(success, failure);
* BluetoothSerial.write([186, 220, 222]).then(success, failure);
*
* // Typed Array
* var data = new Uint8Array(4);
@ -18,10 +21,10 @@ import { Observable } from 'rxjs/Observable';
* data[1] = 0x42;
* data[2] = 0x43;
* data[3] = 0x44;
* Bluetooth.write(data).then(success, failure);
* BluetoothSerial.write(data).then(success, failure);
*
* // Array Buffer
* Bluetooth.write(data.buffer).then(success, failure);
* BluetoothSerial.write(data.buffer).then(success, failure);
* ```
*/
@Plugin({
@ -218,4 +221,5 @@ export class BluetoothSerial {
sync: true
})
static setDiscoverable(discoverableDuration: number): void { }
}

View File

@ -8,8 +8,9 @@ import { Cordova, Plugin } from './plugin';
* Requires Cordova plugin: `cordova-plugin-brightness`. For more info, please see the [Brightness plugin docs](https://github.com/mgcrea/cordova-plugin-brightness).
*
* @usage
* ```ts
* import {Brightness} from 'ionic-native';
* ```typescript
* import { Brightness } from 'ionic-native';
*
*
* let brightnessValue: number = 0.8;
* Brightness.setBrightness(brightnessValue);
@ -47,4 +48,5 @@ export class Brightness {
*/
@Cordova()
static setKeepScreenOn(value: boolean): void { }
}

View File

@ -417,4 +417,5 @@ export class Calendar {
*/
@Cordova()
static openCalendar(date: Date): Promise<any> { return; }
}

View File

@ -1,30 +1,31 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from 'rxjs/Observable';
import { Cordova, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';
export interface CameraPreviewOptions {
x: number;
y: number;
width: number;
height: number;
/**
* Choose the camera to use (front- or back-facing).
* 'front' for front camera
* 'rear' for rear camera
*/
camera: string;
/** Take photo on tap */
tapPhoto: boolean;
/** */
previewDrag: boolean;
/** */
toBack: boolean;
/** Alpha use when toBack is set to true */
alpha: number;
x: number;
y: number;
width: number;
height: number;
/**
* Choose the camera to use (front- or back-facing).
* 'front' for front camera
* 'rear' for rear camera
*/
camera: string;
/** Take photo on tap */
tapPhoto: boolean;
/** */
previewDrag: boolean;
/** */
toBack: boolean;
/** Alpha use when toBack is set to true */
alpha: number;
}
export interface CameraPreviewSize {
maxWidth: number;
maxHeight: number;
maxWidth: number;
maxHeight: number;
}
/**
@ -50,7 +51,7 @@ export class CameraPreview {
@Cordova({
sync: true
})
static startCamera(options: CameraPreviewOptions): void {};
static startCamera(options: CameraPreviewOptions): void { };
/**
* Stops the camera preview instance.
@ -58,7 +59,7 @@ export class CameraPreview {
@Cordova({
sync: true
})
static stopCamera(): void {};
static stopCamera(): void { };
/**
* Take the picture, the parameter size is optional
@ -66,7 +67,7 @@ export class CameraPreview {
@Cordova({
sync: true
})
static takePicture(size: CameraPreviewSize): void {};
static takePicture(size: CameraPreviewSize): void { };
/**
* Register a callback function that receives the original picture and the image captured from the preview box.
@ -82,7 +83,7 @@ export class CameraPreview {
@Cordova({
sync: true
})
static switchCamera(): void {};
static switchCamera(): void { };
/**
* Show the camera preview box.
@ -90,7 +91,7 @@ export class CameraPreview {
@Cordova({
sync: true
})
static show(): void {};
static show(): void { };
/**
* Hide the camera preview box.
@ -98,7 +99,7 @@ export class CameraPreview {
@Cordova({
sync: true
})
static hide(): void {};
static hide(): voi { };
/**
* Set the default mode for the Flash.
@ -106,7 +107,7 @@ export class CameraPreview {
@Cordova({
sync: true
})
static setFlashMode(mode: number): void {};
static setFlashMode(mode: number): void { };
/**
* Set camera color effect.
@ -114,7 +115,7 @@ export class CameraPreview {
@Cordova({
sync: true
})
static setColorEffect(effect: string): void {};
static setColorEffect(effect: string): void { };
/**
* @private

View File

@ -93,14 +93,16 @@ export interface CameraPopoverOptions {
* Requires {@link module:driftyco/ionic-native} and the Cordova plugin: `cordova-plugin-camera`. For more info, please see the [Cordova Camera Plugin Docs](https://github.com/apache/cordova-plugin-camera).
*
* @usage
* ```js
* import {Camera} from 'ionic-native';
* ```typescript
* import { Camera } from 'ionic-native';
*
*
* Camera.getPicture(options).then((imageData) => {
* // imageData is either a base64 encoded string or a file URI
* // If it's base64:
* let base64Image = "data:image/jpeg;base64," + imageData;
* let base64Image = 'data:image/jpeg;base64,' + imageData;
* }, (err) => {
* // Handle error
* });
* ```
*/

View File

@ -1,13 +1,13 @@
import { Cordova, Plugin } from './plugin';
/**
* @name CardIO
* @description
* @usage
* ```
* import {CardIO} from 'ionic-native';
* import { CardIO } from 'ionic-native';
*
* ...
*
* CardIO.canScan()
* .then(
@ -51,6 +51,7 @@ export class CardIO {
*/
@Cordova()
static version(): Promise<string> { return; }
}
export interface CardIOOptions {

View File

@ -10,19 +10,18 @@ import { Cordova, Plugin } from './plugin';
* For more info, please see the [Clipboard plugin docs](https://github.com/VersoSolutions/CordovaClipboard.git).
*
* @usage
* ```js
* import {Clipboard} from 'ionic-native';
* ```typescript
* import { Clipboard } from 'ionic-native';
*
*
*
* Clipboard.copy("Hello world");
* Clipboard.copy('Hello world');
*
* Clipboard.paste().then(
* (resolve : string) => {
* (resolve: string) => {
* alert(resolve);
* },
* (reject : string) => {
* alert("Error: " + reject);
* (reject: string) => {
* alert('Error: ' + reject);
* }
* );
* );

View File

@ -1,4 +1,4 @@
import { Cordova, CordovaInstance, Plugin, InstanceProperty } from './plugin';
import { Cordova, CordovaInstance, InstanceProperty, Plugin } from './plugin';
declare var window: any,
@ -257,16 +257,15 @@ export class ContactFindOptions implements IContactFindOptions {
*
* @usage
*
* ```js
* import {Contact} from 'ionic-native';
*
* ```typescript
* import { Contact } from 'ionic-native';
*
*
* let contact = new Contact();
* contact.displayName = "Mr. Ionitron";
* contact.displayName = 'Mr. Ionitron';
* contact.save().then(
* () => console.log("Contact saved!", contact),
* (error: any) => console.error("Error saving contact.", error)
* () => console.log('Contact saved!', contact),
* (error: any) => console.error('Error saving contact.', error)
* );
* ```
*
@ -308,4 +307,5 @@ export class Contacts {
*/
@Cordova()
static pickContact(): Promise<any> { return; }
}

View File

@ -1,5 +1,6 @@
import { Cordova, Plugin } from './plugin';
export interface DatePickerOptions {
/**
* Platforms: iOS, Android, Windows
@ -73,16 +74,16 @@ export interface DatePickerOptions {
* Requires Cordova plugin: `cordova-plugin-datepicker`. For more info, please see the [DatePicker plugin docs](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker).
*
* @usage
* ```js
* import {DatePicker} from 'ionic-native';
* ```typescript
* import { DatePicker } from 'ionic-native';
*
*
* DatePicker.show({
* date: new Date(),
* mode: 'date'
* }).then(
* date => console.log("Got date: ", date),
* err => console.log("Error occurred while getting date:", err)
* date => console.log('Got date: ', date),
* err => console.log('Error occurred while getting date: ', err)
* );
* ```
*

View File

@ -6,9 +6,8 @@ import { Observable } from 'rxjs/Observable';
* @name DB Meter
* @description This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone.
* @usage
* ```ts
* import {DBMeter} from 'ionic-native';
*
* ```typescript
* import { DBMeter } from 'ionic-native';
*
*
* // Start listening
@ -18,7 +17,7 @@ import { Observable } from 'rxjs/Observable';
*
* // Check if we are listening
* DBMeter.isListening().then(
* (isListening : boolean) => console.log(isListening)
* (isListening: boolean) => console.log(isListening)
* );
*
* // Stop listening
@ -26,8 +25,8 @@ import { Observable } from 'rxjs/Observable';
*
* // Delete DBMeter instance from memory
* DBMeter.delete().then(
* () => console.log("Deleted DB Meter instance"),
* error => console.log("Error occurred while deleting DB Meter instance")
* () => console.log('Deleted DB Meter instance'),
* error => console.log('Error occurred while deleting DB Meter instance')
* );
* ```
*/

View File

@ -27,8 +27,8 @@ export interface DeeplinkMatch {
* and Universal App Links.
*
* @usage
* ```ts
* import {IonicDeeplinks} from 'ionic-native';
* ```typescript
* import { IonicDeeplinks } from 'ionic-native';
*
* ```
*/
@ -77,4 +77,5 @@ export class Deeplinks {
observable: true
})
static routeWithNavController(navController, paths): Observable<DeeplinkMatch> { return; }
}

View File

@ -33,9 +33,8 @@ export interface Device {
* Access information about the underlying device and platform.
*
* @usage
* ```js
* import {Device} from 'ionic-native';
*
* ```typescript
* import { Device } from 'ionic-native';
*
*
* console.log('Device UUID is: ' + Device.device.uuid);
@ -55,4 +54,5 @@ export class Device {
*/
@CordovaProperty
static get device() { return window.device; }
}

View File

@ -32,4 +32,5 @@ export class DeviceAccounts {
*/
@Cordova()
static getEmail(): Promise<any> { return; }
}

View File

@ -41,19 +41,18 @@ export interface AccelerometerOptions {
* Requires Cordova plugin: `cordova-plugin-device-motion`. For more info, please see the [Device Motion docs](https://github.com/apache/cordova-plugin-device-motion).
*
* @usage
* ```ts
* import {DeviceMotion} from 'ionic-native';
*
* ```typescript
* import { DeviceMotion } from 'ionic-native';
*
*
* // Get the device current acceleration
* DeviceMotion.getCurrentAcceleration().then(
* acceleration => console.log(acceleration),
* error => console.log(error)
* (acceleration: AccelerationData) => console.log(acceleration),
* (error: any) => console.log(error)
* );
*
* // Watch device acceleration
* var subscription = DeviceMotion.watchAcceleration().subscribe(acceleration => {
* var subscription = DeviceMotion.watchAcceleration().subscribe((acceleration: AccelerationData) => {
* console.log(acceleration);
* });
*
@ -87,4 +86,5 @@ export class DeviceMotion {
clearFunction: 'clearWatch'
})
static watchAcceleration(options?: AccelerometerOptions): Observable<AccelerationData> { return; }
}

View File

@ -46,20 +46,19 @@ export interface CompassOptions {
* Requires Cordova plugin: `cordova-plugin-device-orientation`. For more info, please see the [Device Orientation docs](https://github.com/apache/cordova-plugin-device-orientation).
*
* @usage
* ```ts
* import {DeviceOrientation} from 'ionic-native';
*
* ```typescript
* import { DeviceOrientation } from 'ionic-native';
*
*
* // Get the device current compass heading
* DeviceOrientation.getCurrentHeading().then(
* data => console.log(data),
* error => console.log(error)
* (data: CompassHeading) => console.log(data),
* (error: any) => console.log(error)
* );
*
* // Watch the device compass heading change
* var subscription = DeviceOrientation.watchHeading().subscribe(
* data => console.log(data)
* (data: CompassHeading) => console.log(data)
* );
*
* // Stop watching heading change

View File

@ -95,4 +95,5 @@ export class Diagnostic {
*/
@Cordova()
static isRegisteredForRemoteNotifications(): Promise<any> { return; }
}

View File

@ -23,8 +23,8 @@ export interface PromptCallback {
* Requires Cordova plugin: `cordova-plugin-dialogs`. For more info, please see the [Dialogs plugin docs](https://github.com/apache/cordova-plugin-dialogs).
*
* @usage
* ```js
* import {Dialogs} from 'ionic-native';
* ```typescript
* import { Dialogs } from 'ionic-native';
*
*
*

View File

@ -12,11 +12,11 @@ declare var cordova: any;
* DISCLAIMER: This plugin is experiencing issues with the latest versions of Cordova. Use at your own risk. Functionality is not guaranteed. Please stay tuned for a more stable version.
*
* @usage
* ```ts
* import {EmailComposer} from 'ionic-native';
* ```typescript
* import { EmailComposer } from 'ionic-native';
*
*
* EmailComposer.isAvailable().then((available) =>{
* EmailComposer.isAvailable().then((available: boolean) =>{
* if(available) {
* //Now we know we can send
* }

View File

@ -69,8 +69,8 @@ import { Cordova, Plugin } from './plugin';
* For tracking events, see `logEvent` and `logPurchase`.
*
* @usage
* ```js
* import {Facebook} from 'ionic-native';
* ```typescript
* import { Facebook } from 'ionic-native';
*
*
*
@ -98,7 +98,7 @@ export class Facebook {
/**
* Login to Facebook to authenticate this app.
*
* ```ts
* ```typescript
* {
* status: "connected",
* authResponse: {
@ -245,7 +245,9 @@ export class Facebook {
url: string,
picture: string
}): Promise<any> { return; }
}
export interface FacebookLoginResponse {
status: string;
authResponse: {

View File

@ -112,24 +112,20 @@ export interface FileTransferError {
* This plugin allows you to upload and download files.
*
* @usage
* ```typescript
* import { Transfer } from 'ionic-native';
*
* Create instance:
* ```ts
*
* // Create instance:
* const fileTransfer = new Transfer();
* ```
*
* Upload a file:
* ```ts
* // Upload a file:
* fileTransfer.upload(..).then(..).catch(..);
* ```
*
* Download a file:
* ```ts
* // Download a file:
* fileTransfer.download(..).then(..).catch(..);
* ```
*
* Abort active transfer:
* ```ts
* // Abort active transfer:
* fileTransfer.abort();
* ```
*

View File

@ -8,8 +8,8 @@ import { Cordova, Plugin } from './plugin';
* Requires Cordova plugin: `cordova-plugin-flashlight`. For more info, please see the [Flashlight plugin docs](https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin).
*
* @usage
* ```js
* import {Flashlight} from 'ionic-native';
* ```typescript
* import { Flashlight } from 'ionic-native';
*
*
*

View File

@ -102,20 +102,19 @@ export interface GeolocationOptions {
*
* @usage
*
* ```ts
* import {Geolocation} from 'ionic-native';
*
* ```typescript
* import { Geolocation } from 'ionic-native';
*
*
* Geolocation.getCurrentPosition().then((resp) => {
* //resp.coords.latitude
* //resp.coords.longitude
* // resp.coords.latitude
* // resp.coords.longitude
* })
*
* let watch = Geolocation.watchPosition();
* watch.subscribe((data) => {
* //data.coords.latitude
* //data.coords.longitude
* // data.coords.latitude
* // data.coords.longitude
* })
* ```
*/
@ -140,7 +139,7 @@ export class Geolocation {
* Watch the current device's position. Clear the watch by unsubscribing from
* Observable changes.
*
* ```ts
* ```typescript
* var subscription = Geolocation.watchPosition().subscribe(position => {
* console.log(position.coords.longitude + ' ' + position.coords.latitude);
* });

View File

@ -4,9 +4,8 @@ import { Cordova, Plugin } from './plugin';
* @name Globalization
* @description
* @usage
* ```js
* import {Globalization} from 'ionic-native';
*
* ```typescript
* import { Globalization } from 'ionic-native';
*
*
* ```

View File

@ -5,7 +5,9 @@ import { Cordova, Plugin } from './plugin';
* @name Google Plus
* @description
* @usage
* ```
* ```typescript
* import { GooglePlus } from 'ionic-native';
*
*
* ```
*/

View File

@ -46,14 +46,14 @@ export const GoogleMapsAnimation = {
* @description This plugin uses the native Google Maps SDK
* @usage
* ```
* import {GoogleMap, GoogleMapsEvent} from 'ionic-native';
* import { GoogleMap, GoogleMapsEvent } from 'ionic-native';
*
* ...
*
* // somewhere in your component
* let map = new GoogleMap('elementID');
*
* map.on(GoogleMapsEvent.MAP_READY).subscribe(() => console.log("Map is ready!"));
* map.on(GoogleMapsEvent.MAP_READY).subscribe(() => console.log('Map is ready!'));
* ```
*/
@Plugin({

View File

@ -4,14 +4,13 @@ import { Cordova, Plugin } from './plugin';
* @name Hotspot
* @description
* @usage
* ```js
* import {Hotspot, Network} from 'ionic-native';
* ```typescript
* import { Hotspot, Network } from 'ionic-native';
*
* ...
* Hotspot.scanWifi().then((networks: Array<Network>) => {
* console.log(networks);
* });
* ...
*
* Hotspot.scanWifi().then((networks: Array<Network>) => {
* console.log(networks);
* });
*
* ```
*/

View File

@ -231,8 +231,8 @@ export interface Delegate {
*
* @usage
*
* ```ts
* import {IBeacon} from 'ionic-native';
* ```typescript
* import { IBeacon } from 'ionic-native';
*
*
* // Request permission to use location on iOS
@ -243,13 +243,13 @@ export interface Delegate {
* // Subscribe to some of the delegate's event handlers
* delegate.didRangeBeaconsInRegion()
* .subscribe(
* data => {console.log('didRangeBeaconsInRegion: ', data)},
* error => console.error
* data => console.log('didRangeBeaconsInRegion: ', data),
* error => console.error();
* );
* delegate.didStartMonitoringForRegion()
* .subscribe(
* data => {console.log('didStartMonitoringForRegion: ', data)},
* error => console.error
* data => console.log('didStartMonitoringForRegion: ', data),
* error => console.error();
* );
* delegate.didEnterRegion()
* .subscribe(

View File

@ -27,8 +27,8 @@ export interface ImagePickerOptions {
* For more info, please see the https://github.com/wymsee/cordova-imagePicker
*
* @usage
* ```js
* import {ImagePicker} from 'ionic-native';
* ```typescript
* import { ImagePicker } from 'ionic-native';
*
*
*
@ -36,8 +36,7 @@ export interface ImagePickerOptions {
* for (var i = 0; i < results.length; i++) {
* console.log('Image URI: ' + results[i]);
* }
* }, (err) => {
* });
* }, (err) => { });
* ```
*/
@Plugin({

View File

@ -7,8 +7,9 @@ import { Cordova, Plugin } from './plugin';
* Prevent the screen of the mobile device from falling asleep.
*
* @usage
* ```js
* import {Insomnia} from 'ionic-native';
* ```typescript
* import { Insomnia } from 'ionic-native';
*
*
* Insomnia.keepAwake()
* .then(

View File

@ -6,8 +6,8 @@ import { Observable } from 'rxjs/Observable';
* @name Keyboard
* @description
* @usage
* ```js
* import {Keyboard} from 'ionic-native';
* ```typescript
* import { Keyboard } from 'ionic-native';
*
*
*

View File

@ -66,18 +66,18 @@ export interface LaunchNavigatorOptions {
* @usage
* Please refer to the plugin's repo for detailed usage. This docs page only explains the Native wrapper.
*
* ```js
* import {LaunchNavigator, LaunchNavigatorOptions} from 'ionic-native';
* ```typescript
* import { LaunchNavigator, LaunchNavigatorOptions } from 'ionic-native';
*
* let options: LaunchNavigatorOptions = {
* start: 'London, ON',
* app: LaunchNavigator.APPS.UBER
* };
*
* LaunchNavigator.navigate("Toronto, ON", options)
* LaunchNavigator.navigate('Toronto, ON', options)
* .then(
* success => console.log("Launched navigator"),
* error => console.log("Error launching navigator", error)
* success => console.log('Launched navigator'),
* error => console.log('Error launching navigator', error)
* );
* ```
*/

View File

@ -7,15 +7,14 @@ import { Cordova, Plugin } from './plugin';
* This plugin allows you to display local notifications on the device
*
* @usage
* ```ts
* import {LocalNotifications} from 'ionic-native';
*
* ```typescript
* import { LocalNotifications } from 'ionic-native';
*
*
* // Schedule a single notification
* LocalNotifications.schedule({
* id: 1,
* text: "Single Notification",
* text: 'Single Notification',
* sound: isAndroid? 'file://sound.mp3': 'file://beep.caf'
* data: { secret: key }
* });
@ -24,22 +23,22 @@ import { Cordova, Plugin } from './plugin';
* // Schedule multiple notifications
* LocalNotifications.schedule([{
* id: 1,
* text: "Multi Notification 1",
* text: 'Multi Notification 1',
* sound: isAndroid ? 'file://sound.mp3': 'file://beep.caf',
* data: { secret:key }
* },{
* id: 2,
* title: "Local Notification Example",
* text: "Multi Notification 2",
* icon: "http://example.com/icon.png"
* title: 'Local Notification Example',
* text: 'Multi Notification 2',
* icon: 'http://example.com/icon.png'
* }]);
*
*
* // Schedule delayed notification
* LocalNotifications.schedule({
* text: "Delayed Notification",
* text: 'Delayed Notification',
* at: new Date(new Date().getTime() + 3600),
* led: "FF0000",
* led: 'FF0000',
* sound: null
* });
* ```

View File

@ -9,9 +9,8 @@ declare var navigator: any;
* @description
* @usage
* ```typescript
* import {MediaCapture} from 'ionic-native';
* import { MediaCapture } from 'ionic-native';
*
* ...
*
* let options: CaptureImageOptions = { limit: 3 };
* MediaCapture.captureImage(options)

View File

@ -8,22 +8,22 @@ declare var Media: any;
* @name MediaPlugin
* @description
* @usage
* ```ts
* import {MediaPlugin} from 'ionic-native';
* ```typescript
* import { MediaPlugin } from 'ionic-native';
*
*
*
* // Create a MediaPlugin instance. Expects path to file or url as argument
* var file = new MediaPlugin("path/to/file.mp3");
* var file = new MediaPlugin('path/to/file.mp3');
*
* // Catch the Success & Error Output
* // Platform Quirks
* // iOS calls success on completion of playback only
* // Android calls success on completion of playback AND on release()
* file.init.then(() => {
* console.log("Playback Finished");
* console.log('Playback Finished');
* }, (err) => {
* console.log("somthing went wrong! error code: "+err.code+" message: "+err.message);
* console.log('somthing went wrong! error code: ' + err.code + ' message: ' + err.message);
* });
*
* // play the file
@ -55,7 +55,7 @@ declare var Media: any;
* file.release();
*
* // Recording to a file
* var newFile = new MediaPlugin("path/to/file.mp3");
* var newFile = new MediaPlugin('path/to/file.mp3');
* newFile.startRecord();
*
* newFile.stopRecord();

View File

@ -7,7 +7,7 @@ import { Cordova, Plugin } from './plugin';
*
* @usage
* ```typescript
* import {NativeStorage} from 'ionic-native';
* import { NativeStorage } from 'ionic-native';
*
* NativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'})
* .then(

View File

@ -10,12 +10,12 @@ declare var navigator: any;
* Requires Cordova plugin: cordova-plugin-network-information. For more info, please see the [Network plugin docs](https://github.com/apache/cordova-plugin-network-information).
*
* @usage
* ```js
* import {Network} from 'ionic-native';
* ```typescript
* import { Network } from 'ionic-native';
*
* // watch network for a disconnect
* let disconnectSubscription = Network.onDisconnect().subscribe(() => {
* console.log('network was disconnected :-( ')
* console.log('network was disconnected :-(');
* });
*
* // stop disconnect watch
@ -24,9 +24,9 @@ declare var navigator: any;
*
* // watch network for a connection
* let connectSubscription = Network.onConnect().subscribe(() => {
* console.log('network connected!');*
* 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
* // before we determine the connection type. Might need to wait
* // prior to doing any api requests as well.
* setTimeout(() => {
* if (Network.connection === 'wifi') {

View File

@ -10,15 +10,16 @@ import { Cordova, Plugin } from './plugin';
* Requires Cordova plugin: `onesignal-cordova-plugin`. For more info, please see the [OneSignal Cordova Docs](https://documentation.onesignal.com/docs/phonegap-sdk-installation).
*
* @usage
* ```ts
* import {OneSignal} from 'ionic-native';
* ```typescript
* import { OneSignal } from 'ionic-native';
*
* let notificationOpenedCallback(jsonData: any) {
* console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
* };
* OneSignal.init("b2f7f966-d8cc-11e4-bed1-df8f05be55ba",
* {googleProjectNumber: "703322744261"},
* notificationOpenedCallback);
*
* OneSignal.init('b2f7f966-d8cc-11e4-bed1-df8f05be55ba',
* {googleProjectNumber: '703322744261'},
* notificationOpenedCallback);
*
* OneSignal.enableInAppAlertNotification(true);
* ```

View File

@ -7,14 +7,13 @@ import { Cordova, Plugin } from './plugin';
*
* @usage
* ```typescript
* import {PinDialog} from 'ionic-native';
* import { PinDialog } from 'ionic-native';
*
* ...
*
* 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);
* if (result.buttonIndex == 1) console.log('User clicked OK, value is: ', result.input1);
* else if(result.buttonIndex == 2) console.log('User cancelled');
* }
* );

View File

@ -1,10 +1,10 @@
import { get } from '../util';
import { Observable } from 'rxjs/Observable';
declare var window;
declare var Promise;
declare var $q;
import {Observable} from 'rxjs/Observable';
/**
* @private
@ -230,7 +230,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: any = {})
* Class decorator specifying Plugin metadata. Required for all plugins.
*
* @usage
* ```ts
* ```typescript
* @Plugin({
* name: 'MyPlugin',
* plugin: 'cordova-plugin-myplugin',

View File

@ -65,19 +65,19 @@ export interface PushNotification {
* @param event
* @param callback
*/
on(event: "registration", callback: (response: RegistrationEventResponse) => any): void;
on(event: 'registration', callback: (response: RegistrationEventResponse) => any): void;
/**
* The event notification will be triggered each time a push notification is received by a 3rd party push service on the device.
* @param event
* @param callback
*/
on(event: "notification", callback: (response: NotificationEventResponse) => any): void;
on(event: 'notification', callback: (response: NotificationEventResponse) => any): void;
/**
* The event error will trigger when an internal error occurs and the cache is aborted.
* @param event
* @param callback
*/
on(event: "error", callback: (response: Error) => any): void;
on(event: 'error', callback: (response: Error) => any): void;
/**
*
* @param event Name of the event to listen to. See below(above) for all the event names.
@ -87,9 +87,9 @@ export interface PushNotification {
*/
on(event: string, callback: (response: EventResponse) => any): void;
off(event: "registration", callback: (response: RegistrationEventResponse) => any): void;
off(event: "notification", callback: (response: NotificationEventResponse) => any): void;
off(event: "error", callback: (response: Error) => any): void;
off(event: 'registration', callback: (response: RegistrationEventResponse) => any): void;
off(event: 'notification', callback: (response: NotificationEventResponse) => any): void;
off(event: 'error', callback: (response: Error) => any): void;
/**
* As stated in the example, you will have to store your event handler if you are planning to remove it.
* @param event Name of the event type. The possible event names are the same as for the push.on function.
@ -279,11 +279,8 @@ declare var PushNotification: {
* For TypeScript users, see the [Push plugin docs about using TypeScript for custom notifications](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/TYPESCRIPT.md).
*
* @usage
* ```js
* import {Push} from 'ionic-native';
*
*
*
* ```typescript
* import { Push } from 'ionic-native';
* ```
*/
@Plugin({
@ -299,10 +296,10 @@ export class Push {
* ```
* var push = Push.init({
* android: {
* senderID: "12345679"
* senderID: '12345679'
* },
* ios: {
* alert: "true",
* alert: 'true',
* badge: true,
* sound: 'false'
* },

View File

@ -6,13 +6,12 @@ import { Cordova, Plugin } from './plugin';
* @description
* @usage
* ```
* import {SafariViewController} from 'ionic-native';
* import { SafariViewController } from 'ionic-native';
*
* ...
*
* SafariViewController.isAvailable()
* .then(
* (available) => {
* (available: boolean) => {
* if(available){
*
* SafariViewController.show({
@ -25,9 +24,9 @@ import { Cordova, Plugin } from './plugin';
* })
* .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");
* if(result.event === 'opened') console.log('Opened');
* else if(result.event === 'loaded') console.log('Loaded');
* else if(result.event === 'closed') console.log('Closed');
* },
* (error: any) => console.error(error)
* );

View File

@ -9,13 +9,13 @@ import { Cordova, Plugin } from './plugin';
* Requires Cordova plugin: `cordova-plugin-sim`. For more info, please see the [Cordova Sim docs](https://github.com/pbakondy/cordova-plugin-sim).
*
* @usage
* ```js
* import {Sim} from 'ionic-native';
* ```typescript
* import { Sim } from 'ionic-native';
*
*
* Sim.getSimInfo().then(
* (info) => console.log('Sim info:', info),
* (err) => console.log('Unable to get sim info:', err)
* (info) => console.log('Sim info: ', info),
* (err) => console.log('Unable to get sim info: ', err)
* );
* ```
*/

View File

@ -31,14 +31,12 @@ export interface SmsOptionsAndroid {
* Requires Cordova plugin: cordova-plugin-sms. For more info, please see the [SMS plugin docs](https://github.com/cordova-sms/cordova-sms-plugin).
*
* @usage
* ```ts
* import {SMS} from 'ionic-native';
*
* ```typescript
* import { SMS } from 'ionic-native';
*
*
* // Send a text message using default options
* SMS.send('416123456','Hello world!');
*
* SMS.send('416123456', 'Hello world!');
* ```
*/
@Plugin({

View File

@ -1,12 +1,13 @@
import { Cordova, Plugin } from './plugin';
/**
* @name Social Sharing
* @description
* Share text, files, images, and links via social networks, sms, and email.
* @usage
* ```ts
* import {SocialSharing} from 'ionic-native';
* ```typescript
* import { SocialSharing } from 'ionic-native';
*
* // Check if sharing via email is supported
* SocialSharing.canShareViaEmail().then(() => {

View File

@ -5,9 +5,8 @@ import { Cordova, Plugin } from './plugin';
* @name Spinner Dialog
* @description
* @usage
* ```js
* import {SpinnerDialog} from 'ionic-native';
*
* ```typescript
* import { SpinnerDialog } from 'ionic-native';
*
*
* SpinnerDialog.show();

View File

@ -5,9 +5,8 @@ import { Cordova, Plugin } from './plugin';
* @name Splashscreen
* @description This plugin displays and hides a splash screen during application launch. The methods below allows showing and hiding the splashscreen after the app has loaded.
* @usage
* ```ts
* import {Splashscreen} from 'ionic-native';
*
* ```typescript
* import { Splashscreen } from 'ionic-native';
*
*
* Splashscreen.show();

View File

@ -11,7 +11,7 @@ declare var sqlitePlugin;
*
* @usage
*
* ```ts
* ```typescript
* import { SQLite } from 'ionic-native';
*
* let db = new SQLite();
@ -22,10 +22,10 @@ declare var sqlitePlugin;
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
*
* }, (err) => {
* console.error('Unable to execute sql', err);
* })
* console.error('Unable to execute sql: ', err);
* });
* }, (err) => {
* console.error('Unable to open database', err);
* console.error('Unable to open database: ', err);
* });
* ```
*
@ -52,7 +52,7 @@ export class SQLite {
* @param config the config for opening the database.
* @usage
*
* ```ts
* ```typescript
* import { SQLite } from 'ionic-native';
*
* let db = new SQLite();
@ -112,7 +112,7 @@ export class SQLite {
*
* @usage
*
* ```ts
* ```typescript
* db.executeSql('SELECT FROM puppies WHERE type = ?', ['cavalier']).then((resultSet) => {
* // Access the items through resultSet.rows
* // resultSet.rows.item(i)

View File

@ -11,10 +11,9 @@ declare var window;
* Requires Cordova plugin: `cordova-plugin-statusbar`. For more info, please see the [StatusBar plugin docs](https://github.com/apache/cordova-plugin-statusbar).
*
* @usage
* ```ts
* import {StatusBar} from 'ionic-native';
* ```typescript
* import { StatusBar } from 'ionic-native';
*
* ...
*
* StatuBar.overlaysWebView(true); // let status var overlay webview
*

View File

@ -43,12 +43,11 @@ export interface ToastOptions {
* Requires Cordova plugin: `cordova-plugin-x-toast`. For more info, please see the [Toast plugin docs](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin).
*
* @usage
* ```ts
* import {Toast} from 'ionic-native';
* ```typescript
* import { Toast } from 'ionic-native';
*
*
*
* Toast.show("I'm a toast", "5000", "center").subscribe(
* Toast.show("I'm a toast", '5000', 'center').subscribe(
* toast => {
* console.log(toast);
* }

View File

@ -21,23 +21,21 @@ import { Cordova, Plugin } from './plugin';
* - `-6` - TouchID is not Available
* - `-8` - TouchID is locked out from too many tries
* @usage
* ```js
* import {TouchID} from 'ionic-native';
* ```typescript
* import { TouchID } from 'ionic-native';
*
* ...
*
* TouchID.isAvailable()
* .then(
* res => console.log("TouchID is available!"),
* err => console.error("TouchID isn't available", err)
* res => console.log('TouchID is available!'),
* err => console.error('TouchID isn't available', err)
* );
*
* TouchID.verifyFingerprint('Scan your fingerprint please')
* .then(
* res => console.log("Ok", res),
* err => console.error("Error", err)
* res => console.log('Ok', res),
* err => console.error('Error', err)
* );
*
* ```
*/
@Plugin({

View File

@ -1,4 +1,6 @@
import { Plugin, Cordova } from './plugin';
/**
* @name Twitter Connect
* @description

View File

@ -5,9 +5,8 @@ import { Cordova, Plugin } from './plugin';
* @name Vibration
* @description Vibrates the device
* @usage
* ```ts
* import {Vibration} from 'ionic-native';
*
* ```typescript
* import { Vibration } from 'ionic-native';
*
*
* // Vibrate the device for a second