Merge pull request #149 from driftyco/add-tslint

chore(tslint): add tslint & clean up code
This commit is contained in:
Ibrahim Hadeed 2016-04-29 23:58:02 -04:00
commit e34d4e335b
58 changed files with 1014 additions and 941 deletions

View File

@ -2,6 +2,7 @@ var gulp = require('gulp');
var minimist = require('minimist');
var uglify = require('gulp-uglify');
var rename = require("gulp-rename");
var tslint = require('gulp-tslint');
var flagConfig = {
string: ['port', 'version', 'ngVersion', 'animations'],
@ -23,3 +24,9 @@ gulp.task("minify:dist", function(){
}))
.pipe(gulp.dest('./dist'));
});
gulp.task("tslint", function(){
gulp.src("src/**/*.ts")
.pipe(tslint())
.pipe(tslint.report('verbose'));
});

View File

@ -23,6 +23,7 @@
"glob": "^6.0.4",
"gulp": "~3.9.0",
"gulp-rename": "^1.2.2",
"gulp-tslint": "^5.0.0",
"gulp-uglify": "^1.5.3",
"lodash": "3.10.1",
"minimist": "^1.1.3",
@ -30,6 +31,8 @@
"node-html-encoder": "0.0.2",
"q": "1.4.1",
"semver": "^5.0.1",
"tslint": "^3.8.1",
"tslint-eslint-rules": "^1.3.0",
"typescript": "^1.7.5"
},
"scripts": {

View File

@ -183,7 +183,7 @@ document.addEventListener('deviceready', function() {
});
setTimeout(function() {
if(!didFireReady && window.cordova) {
if (!didFireReady && window.cordova) {
console.warn('Native: deviceready did not fire within ' + DEVICE_READY_TIMEOUT + 'ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.');
}
}, DEVICE_READY_TIMEOUT);

View File

@ -4,7 +4,7 @@ declare var window;
* Initialize the ngCordova Angular module if we're running in ng1
*/
export function initAngular1() {
if(window.angular) {
if (window.angular) {
window.angular.module('ngCordova', []);
}
}
@ -12,12 +12,12 @@ export function initAngular1() {
/**
* Publish a new Angular 1 service for this plugin.
*/
export function publishAngular1Service(config:any, cls:any) {
export function publishAngular1Service(config: any, cls: any) {
let serviceName = '$cordova' + cls.name;
console.log('Registering Angular1 service', serviceName);
window.angular.module('ngCordova').service(serviceName, [function() {
let funcs = {};
for(var k in cls) {
for (var k in cls) {
}
return funcs;
}]);

View File

@ -59,12 +59,12 @@ export class ActionSheet {
addCancelButtonWithLabel?: string,
addDestructiveButtonWithLabel?: string,
position?: number[]
}): Promise<any> { return }
}): Promise<any> { return; }
/**
* Hide the ActionSheet.
*/
@Cordova()
static hide(): Promise<any> { return }
static hide(): Promise<any> { return; }
}

View File

@ -1,5 +1,5 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from "rxjs/Observable";
import {Observable} from 'rxjs/Observable';
/**
* @name AdMob
@ -20,7 +20,7 @@ export class AdMob {
* @param adIdOrOptions
*/
@Cordova()
static createBanner(adIdOrOptions : any) : Promise<any> {return}
static createBanner(adIdOrOptions: any): Promise<any> {return; }
/**
*
@ -28,7 +28,7 @@ export class AdMob {
@Cordova({
sync: true
})
static removeBanner() : void {}
static removeBanner(): void {}
/**
*
@ -37,7 +37,7 @@ export class AdMob {
@Cordova({
sync: true
})
static showBanner(position : any) : void {}
static showBanner(position: any): void {}
/**
*
@ -47,7 +47,7 @@ export class AdMob {
@Cordova({
sync: true
})
static showBannerAtXY(x : number, y : number) : void {}
static showBannerAtXY(x: number, y: number): void {}
/**
*
@ -55,14 +55,14 @@ export class AdMob {
@Cordova({
sync: true
})
static hideBanner() : void {}
static hideBanner(): void {}
/**
*
* @param adIdOrOptions
*/
@Cordova()
static prepareInterstitial(adIdOrOptions : any) : Promise<any> {return}
static prepareInterstitial(adIdOrOptions: any): Promise<any> {return; }
/**
* Show interstitial
@ -70,42 +70,42 @@ export class AdMob {
@Cordova({
sync: true
})
static showInterstitial() : void {}
static showInterstitial(): void {}
/**
*
*/
@Cordova()
static isInterstitialReady () : Promise<boolean> {return}
static isInterstitialReady (): Promise<boolean> {return; }
/**
* Prepare a reward video ad
* @param adIdOrOptions
*/
@Cordova()
static prepareRewardVideoAd(adIdOrOptions : any) : Promise<any> {return}
static prepareRewardVideoAd(adIdOrOptions: any): Promise<any> {return; }
/**
* Show a reward video ad
*/
@Cordova({
sync : true
sync: true
})
static showRewardVideoAd() : void {}
static showRewardVideoAd(): void { }
/**
* Sets the values for configuration and targeting
* @param options Returns a promise that resolves if the options are set successfully
*/
@Cordova()
static setOptions(options:any) : Promise<any> {return}
static setOptions(options: any): Promise<any> {return; }
/**
* Get user ad settings
* @returns {Promise<any>} Returns a promise that resolves with the ad settings
*/
@Cordova()
static getAdSettings() : Promise<any> {return}
static getAdSettings(): Promise<any> {return; }
// Events
@ -113,65 +113,65 @@ export class AdMob {
eventObservable: true,
event: 'onBannerFailedToReceive'
})
static onBannerFailedToReceive () : Observable<any> {return}
static onBannerFailedToReceive (): Observable<any> {return; }
@Cordova({
eventObservable: true,
event: 'onBannerReceive'
})
static onBannerReceive () : Observable<any> {return}
static onBannerReceive (): Observable<any> {return; }
@Cordova({
eventObservable: true,
event: 'onBannerPresent'
})
static onBannerPresent () : Observable<any> {return}
static onBannerPresent (): Observable<any> {return; }
@Cordova({
eventObservable: true,
event: 'onBannerLeaveApp'
})
static onBannerLeaveApp () : Observable<any> {return}
static onBannerLeaveApp (): Observable<any> {return; }
@Cordova({
eventObservable: true,
event: 'onBannerDismiss'
})
static onBannerDismiss () : Observable<any> {return}
static onBannerDismiss (): Observable<any> {return; }
@Cordova({
eventObservable: true,
event: 'onInterstitialFailedToReceive'
})
static onInterstitialFailedToReceive () : Observable<any> {return}
static onInterstitialFailedToReceive (): Observable<any> {return; }
@Cordova({
eventObservable: true,
event: 'onInterstitialReceive'
})
static onInterstitialReceive () : Observable<any> {return}
static onInterstitialReceive (): Observable<any> {return; }
@Cordova({
eventObservable: true,
event: 'onInterstitialPresent'
})
static onInterstitialPresent () : Observable<any> {return}
static onInterstitialPresent (): Observable<any> {return; }
@Cordova({
eventObservable: true,
event: 'onInterstitialLeaveApp'
})
static onInterstitialLeaveApp () : Observable<any> {return}
static onInterstitialLeaveApp (): Observable<any> {return; }
@Cordova({
eventObservable: true,
event: 'onInterstitialDismiss'
})
static onInterstitialDismiss () : Observable<any> {return}
static onInterstitialDismiss (): Observable<any> {return; }
}

View File

@ -31,7 +31,7 @@ import {Plugin, Cordova} from './plugin';
plugin: 'cordova-plugin-appavailability',
pluginRef: 'appAvailability',
repo: 'https://github.com/ohh2ahh/AppAvailability',
platforms: ['Android','iOS']
platforms: ['Android', 'iOS']
})
export class AppAvailability {
@ -41,6 +41,6 @@ export class AppAvailability {
* @returns {Promise<boolean>}
*/
@Cordova()
static check(app: string): Promise<boolean> { return }
static check(app: string): Promise<boolean> { return; }
}

View File

@ -25,7 +25,7 @@ declare var window;
plugin: 'cordova-plugin-apprate',
pluginRef: 'AppRate',
repo: 'https://github.com/pushandplay/cordova-plugin-apprate',
platforms: ['Android','iOS']
platforms: ['Android', 'iOS']
})
export class AppRate {

View File

@ -30,27 +30,27 @@ export class AppVersion {
* @returns {Promise}
*/
@Cordova()
static getAppName(): Promise<any> { return }
static getAppName(): Promise<any> { return; }
/**
* Returns the package name of the app
* @returns {Promise}
*/
@Cordova()
static getPackageName(): Promise<any> { return }
static getPackageName(): Promise<any> { return; }
/**
* Returns the build identifier of the app
* @returns {Promise}
*/
@Cordova()
static getVersionCode(): Promise<any> { return }
static getVersionCode(): Promise<any> { return; }
/**
* Returns the version of the app
* @returns {Promise}
*/
@Cordova()
static getVersionNumber(): Promise<any> { return }
static getVersionNumber(): Promise<any> { return; }
}

View File

@ -29,49 +29,49 @@ export class Badge {
* Clear the badge of the app icon.
*/
@Cordova()
static clear(): Promise<boolean> { return }
static clear(): Promise<boolean> { return; }
/**
* Set the badge of the app icon.
* @param {number} number The new badge number.
* @param {number} badgeNumber The new badge number.
* @returns {Promise}
*/
@Cordova()
static set(number: number): Promise<any> { return }
static set(badgeNumber: number): Promise<any> { return; }
/**
* Get the badge of the app icon.
* @returns {Promise}
*/
@Cordova()
static get(): Promise<any> { return }
static get(): Promise<any> { return; }
/**
* Increase the badge number.
* @param {number} count Count to add to the current badge number
* @param {number} increaseBy Count to add to the current badge number
* @returns {Promise}
*/
@Cordova()
static increase(number: number): Promise<any> { return }
static increase(increaseBy: number): Promise<any> { return; }
/**
* Decrease the badge number.
* @param {number} count Count to subtract from the current badge number
* @param {number} decreaseBy Count to subtract from the current badge number
* @returns {Promise}
*/
@Cordova()
static decrease(number: number): Promise<any> { return }
static decrease(decreaseBy: number): Promise<any> { return; }
/**
* Determine if the app has permission to show badges.
*/
@Cordova()
static hasPermission(): Promise<any> { return }
static hasPermission(): Promise<any> { return; }
/**
* Register permission to set badge notifications
* @returns {Promise}
*/
@Cordova()
static registerPermission(): Promise<any> { return }
static registerPermission(): Promise<any> { return; }
}

View File

@ -23,7 +23,7 @@ import {Plugin, Cordova} from './plugin';
plugin: 'phonegap-plugin-barcodescanner',
pluginRef: 'cordova.plugins.barcodeScanner',
repo: 'https://github.com/phonegap/phonegap-plugin-barcodescanner',
platforms: ['Android','iOS','Windows Phone 8','Windows 10','Windows 8','BlackBerry 10', 'Browser']
platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows 10', 'Windows 8', 'BlackBerry 10', 'Browser']
})
export class BarcodeScanner {
@ -32,7 +32,7 @@ export class BarcodeScanner {
* @return Returns a Promise that resolves with scanner data, or rejects with an error.
*/
@Cordova()
static scan(): Promise<any> { return }
static scan(): Promise<any> { return; }
// Not well supported
// @Cordova()

View File

@ -1,4 +1,4 @@
import {Plugin, Cordova} from './plugin'
import {Plugin, Cordova} from './plugin';
/**
* @name Base64 To Gallery
* @description This plugin allows you to save base64 data as a png image into the device
@ -17,7 +17,7 @@ import {Plugin, Cordova} from './plugin'
plugin: 'cordova-base64-to-gallery',
pluginRef: 'cordova',
repo: 'https://github.com/Nexxa/cordova-base64-to-gallery',
platforms: ['Android' ,'iOS', 'Windows Phone 8']
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
export class Base64ToGallery {
@ -27,8 +27,8 @@ export class Base64ToGallery {
* @param prefix
*/
@Cordova()
base64ToGallery(data : string , prefix? : string ) : Promise<any> {
return
base64ToGallery(data: string , prefix?: string ): Promise<any> {
return;
}
}

View File

@ -1,5 +1,5 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from "rxjs/Observable";
import {Observable} from 'rxjs/Observable';
/**
* @name Battery Status
@ -39,7 +39,7 @@ export class BatteryStatus {
eventObservable: true,
event: 'batterystatus'
})
static onChange () : Observable<StatusObject> {return}
static onChange (): Observable<StatusObject> {return; }
/**
* Watch when the battery level goes low
@ -49,7 +49,7 @@ export class BatteryStatus {
eventObservable: true,
event: 'batterylow'
})
static onLow () : Observable<StatusObject> {return}
static onLow (): Observable<StatusObject> {return; }
/**
* Watch when the battery level goes to critial
@ -59,7 +59,7 @@ export class BatteryStatus {
eventObservable: true,
event: 'batterycritical'
})
static onCritical () : Observable<StatusObject> {return}
static onCritical (): Observable<StatusObject> {return; }
}
@ -67,10 +67,10 @@ export interface StatusObject {
/**
* The battery charge percentage
*/
level : number,
level: number;
/**
* A boolean that indicates whether the device is plugged in
*/
isPlugged : boolean
isPlugged: boolean;
}

View File

@ -163,7 +163,7 @@ import {Observable} from 'rxjs/Observable';
plugin: 'cordova-plugin-ble-central',
pluginRef: 'ble',
repo: 'https://github.com/don/cordova-plugin-ble-central',
platforms: ['iOS','Android']
platforms: ['iOS', 'Android']
})
export class BLE {
/**
@ -182,7 +182,7 @@ export class BLE {
@Cordova({
observable: true
})
static scan(services: string[], seconds: number): Observable<any> { return }
static scan(services: string[], seconds: number): Observable<any> { return; }
/**
* Scan and discover BLE peripherals until `stopScan` is called.
@ -205,7 +205,7 @@ export class BLE {
clearFunction: 'stopScan',
clearWithArgs: true
})
static startScan(services: string[]): Observable<any> { return }
static startScan(services: string[]): Observable<any> { return; }
/**
* Stop a scan started by `startScan`.
@ -222,7 +222,7 @@ export class BLE {
* @return returns a Promise.
*/
@Cordova()
static stopScan(): Promise<any> { return }
static stopScan(): Promise<any> { return; }
/**
* Connect to a peripheral.
@ -243,7 +243,7 @@ export class BLE {
clearFunction: 'disconnect',
clearWithArgs: true
})
static connect(deviceId: string): Observable<any> { return }
static connect(deviceId: string): Observable<any> { return; }
/**
* Disconnect from a peripheral.
@ -257,14 +257,14 @@ export class BLE {
* @return Returns a Promise
*/
@Cordova()
static disconnect(deviceId: string): Promise<any> { return }
static disconnect(deviceId: string): Promise<any> { return; }
/**
* Read the value of a characteristic.
*
* @param {string} device_id UUID or MAC address of the peripheral
* @param {string} service_uuid UUID of the BLE service
* @param {string} characteristic_uuid UUID of the BLE characteristic
* @param {string} deviceId UUID or MAC address of the peripheral
* @param {string} serviceUUID UUID of the BLE service
* @param {string} characteristicUUID UUID of the BLE characteristic
* @return Returns a Promise
*/
@Cordova()
@ -272,7 +272,7 @@ export class BLE {
deviceId: string,
serviceUUID: string,
characteristicUUID: string
): Promise<any> { return };
): Promise<any> { return; };
/**
* Write the value of a characteristic.
@ -296,9 +296,9 @@ export class BLE {
* BLE.write(device_id, SERVICE, CHARACTERISTIC, data.buffer);
*
* ```
* @param {string} device_id UUID or MAC address of the peripheral
* @param {string} service_uuid UUID of the BLE service
* @param {string} characteristic_uuid UUID of the BLE characteristic
* @param {string} deviceId UUID or MAC address of the peripheral
* @param {string} serviceUUID UUID of the BLE service
* @param {string} characteristicUUID UUID of the BLE characteristic
* @param {ArrayBuffer} value Data to write to the characteristic, as an ArrayBuffer.
* @return Returns a Promise
*/
@ -308,14 +308,14 @@ export class BLE {
serviceUUID: string,
characteristicUUID: string,
value: ArrayBuffer
): Promise<any> { return }
): Promise<any> { return; }
/**
* Write the value of a characteristic without waiting for confirmation from the peripheral.
*
* @param {string} device_id UUID or MAC address of the peripheral
* @param {string} service_uuid UUID of the BLE service
* @param {string} characteristic_uuid UUID of the BLE characteristic
* @param {string} deviceId UUID or MAC address of the peripheral
* @param {string} serviceUUID UUID of the BLE service
* @param {string} characteristicUUID UUID of the BLE characteristic
* @param {ArrayBuffer} value Data to write to the characteristic, as an ArrayBuffer.
* @return Returns a Promise
*/
@ -325,7 +325,7 @@ export class BLE {
serviceUUID: string,
characteristicUUID: string,
value: ArrayBuffer
): Promise<any> { return }
): Promise<any> { return; }
/**
* Register to be notified when the value of a characteristic changes.
@ -337,9 +337,9 @@ export class BLE {
* });
* ```
*
* @param {string} device_id UUID or MAC address of the peripheral
* @param {string} service_uuid UUID of the BLE service
* @param {string} characteristic_uuid UUID of the BLE characteristic
* @param {string} deviceId UUID or MAC address of the peripheral
* @param {string} serviceUUID UUID of the BLE service
* @param {string} characteristicUUID UUID of the BLE characteristic
* @return Returns an Observable that notifies of characteristic changes.
*/
@Cordova({
@ -351,14 +351,14 @@ export class BLE {
deviceId: string,
serviceUUID: string,
characteristicUUID: string
): Observable<any> { return }
): Observable<any> { return; }
/**
* Stop being notified when the value of a characteristic changes.
*
* @param {string} device_id UUID or MAC address of the peripheral
* @param {string} service_uuid UUID of the BLE service
* @param {string} characteristic_uuid UUID of the BLE characteristic
* @param {string} deviceId UUID or MAC address of the peripheral
* @param {string} serviceUUID UUID of the BLE service
* @param {string} characteristicUUID UUID of the BLE characteristic
* @return Returns a Promise.
*/
@Cordova()
@ -366,7 +366,7 @@ export class BLE {
deviceId: string,
serviceUUID: string,
characteristicUUID: string
): Promise<any> { return }
): Promise<any> { return; }
/**
* Report the connection status.
@ -378,11 +378,11 @@ export class BLE {
* () => { console.log('not connected'); }
* );
* ```
* @param {string} device_id UUID or MAC address of the peripheral
* @param {string} deviceId UUID or MAC address of the peripheral
* @return Returns a Promise.
*/
@Cordova()
static isConnected(deviceId: string): Promise<any> { return }
static isConnected(deviceId: string): Promise<any> { return; }
/**
* Report if bluetooth is enabled.
@ -397,7 +397,7 @@ export class BLE {
* @return Returns a Promise.
*/
@Cordova()
static isEnabled(): Promise<any> { return }
static isEnabled(): Promise<any> { return; }
/**
* Open System Bluetooth settings (Android only).
@ -405,7 +405,7 @@ export class BLE {
* @return Returns a Promise.
*/
@Cordova()
static showBluetoothSettings(): Promise<any> { return }
static showBluetoothSettings(): Promise<any> { return; }
/**
* Enable Bluetooth on the device (Android only).
@ -413,5 +413,5 @@ export class BLE {
* @return Returns a Promise.
*/
@Cordova()
static enable(): Promise<any> { return }
static enable(): Promise<any> { return; }
}

View File

@ -1,5 +1,5 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from "rxjs/Observable";
import {Observable} from 'rxjs/Observable';
/**
* @name Bluetooth Serial
@ -10,7 +10,7 @@ import {Observable} from "rxjs/Observable";
repo: 'https://github.com/don/BluetoothSerial',
plugin: 'cordova-plugin-bluetooth-serial',
pluginRef: 'bluetoothSerial',
platforms: ['Android','iOS','Windows Phone','Browser']
platforms: ['Android', 'iOS', 'Windows Phone', 'Browser']
})
export class BluetoothSerial {
@ -19,9 +19,9 @@ export class BluetoothSerial {
* @param macAddress_or_uuid Identifier of the remote device
*/
@Cordova({
platforms: ['Android','iOS','Windows Phone']
platforms: ['Android', 'iOS', 'Windows Phone']
})
static connect (macAddress_or_uuid : string) : Promise<any> {return}
static connect (macAddress_or_uuid: string): Promise<any> {return; }
/**
* Connect insecurely to a Bluetooth device
@ -30,15 +30,15 @@ export class BluetoothSerial {
@Cordova({
platforms: ['Android']
})
static connectInsecure (macAddress : string) : Promise<any> {return}
static connectInsecure (macAddress: string): Promise<any> {return; }
/**
* Disconnect
*/
@Cordova({
platforms: ['Android','iOS','Windows Phone']
platforms: ['Android', 'iOS', 'Windows Phone']
})
static disconnect () : Promise<any> {return}
static disconnect (): Promise<any> {return; }
/**
* Writes data to the serial port
@ -64,110 +64,110 @@ export class BluetoothSerial {
* ```
*/
@Cordova({
platforms: ['Android', 'iOS','Windows Phone']
platforms: ['Android', 'iOS', 'Windows Phone']
})
static write (data : any) : Promise<any> {return}
static write (data: any): Promise<any> {return; }
/**
* Gets the number of bytes of data available
*/
@Cordova({
platforms: ['Android', 'iOS','Windows Phone']
}) static available () : Promise<any> {return}
platforms: ['Android', 'iOS', 'Windows Phone']
}) static available (): Promise<any> {return; }
/**
* Reads data from the buffer
*/
@Cordova({
platforms: ['Android', 'iOS','Windows Phone']
platforms: ['Android', 'iOS', 'Windows Phone']
})
static read () : Promise<any> {return}
static read (): Promise<any> {return; }
/**
* Reads data from the buffer until it reaches a delimiter
* @param delimiter
*/
@Cordova({
platforms: ['Android', 'iOS','Windows Phone']
platforms: ['Android', 'iOS', 'Windows Phone']
})
static readUntil (delimiter : string) : Promise<any> {return}
static readUntil (delimiter: string): Promise<any> {return; }
/**
* Subscribe to be notified when data is received
* @param delimiter
*/
@Cordova({
platforms: ['Android', 'iOS','Windows Phone'],
platforms: ['Android', 'iOS', 'Windows Phone'],
observable: true,
clearFunction: 'unsubscribe'
})
static subscribe (delimiter : string) : Observable<any> {return}
static subscribe (delimiter: string): Observable<any> {return; }
/**
* Subscribe to be notified when data is received
*/
@Cordova({
platforms: ['Android', 'iOS','Windows Phone'],
platforms: ['Android', 'iOS', 'Windows Phone'],
observable: true,
clearFunction: 'unsubscribeRawData'
})
static subscribeRawData () : Observable<any> {return}
static subscribeRawData (): Observable<any> {return; }
/**
* Clears data in buffer
*/
@Cordova({
platforms: ['Android', 'iOS','Windows Phone']
platforms: ['Android', 'iOS', 'Windows Phone']
})
static clear () : Promise<any> {return}
static clear (): Promise<any> {return; }
/**
* Lists bonded devices
*/
@Cordova({
platforms: ['Android', 'iOS','Windows Phone']
platforms: ['Android', 'iOS', 'Windows Phone']
})
static list () : Promise<any> {return}
static list (): Promise<any> {return; }
/**
* Reports if bluetooth is enabled
*/
@Cordova({
platforms: ['Android', 'iOS','Windows Phone']
platforms: ['Android', 'iOS', 'Windows Phone']
})
static isEnabled () : Promise<any> {return}
static isEnabled (): Promise<any> {return; }
/**
* Reports the connection status
*/
@Cordova({
platforms: ['Android', 'iOS','Windows Phone']
platforms: ['Android', 'iOS', 'Windows Phone']
})
static isConnected () : Promise<any> {return}
static isConnected (): Promise<any> {return; }
/**
* Reads the RSSI from the connected peripheral
*/
@Cordova({
platforms: ['Android', 'iOS','Windows Phone']
platforms: ['Android', 'iOS', 'Windows Phone']
})
static readRSSI () : Promise<any> {return}
static readRSSI (): Promise<any> {return; }
/**
* Show the Bluetooth settings on the device
*/
@Cordova({
platforms: ['Android', 'iOS','Windows Phone']
platforms: ['Android', 'iOS', 'Windows Phone']
})
static showBluetoothSettings () : Promise<any> {return}
static showBluetoothSettings (): Promise<any> {return; }
/**
* Enable Bluetooth on the device
*/
@Cordova({
platforms: ['Android', 'iOS','Windows Phone']
platforms: ['Android', 'iOS', 'Windows Phone']
})
static enable () : Promise<any> {return}
static enable (): Promise<any> {return; }
/**
* Discover unpaired devices
@ -187,19 +187,19 @@ export class BluetoothSerial {
* ```
*/
@Cordova({
platforms: ['Android', 'iOS','Windows Phone']
platforms: ['Android', 'iOS', 'Windows Phone']
})
static discoverUnpaired () : Promise<any> {return}
static discoverUnpaired (): Promise<any> {return; }
/**
* Subscribe to be notified on Bluetooth device discovery. Discovery process must be initiated with the `discoverUnpaired` function.
*/
@Cordova({
platforms: ['Android', 'iOS','Windows Phone'],
platforms: ['Android', 'iOS', 'Windows Phone'],
observable: true,
clearFunction: 'clearDeviceDiscoveredListener'
})
static setDeviceDiscoveredListener () : Observable<any> {return}
static setDeviceDiscoveredListener (): Observable<any> {return; }
/**
* Sets the human readable device name that is broadcasted to other devices
@ -209,7 +209,7 @@ export class BluetoothSerial {
platforms: ['Android'],
sync: true
})
static setName (newName : string) : void {}
static setName (newName: string): void {}
/**
* Makes the device discoverable by other devices
@ -219,7 +219,7 @@ export class BluetoothSerial {
platforms: ['Android'],
sync: true
})
static setDiscoverable (discoverableDuration : number) : void {}
static setDiscoverable (discoverableDuration: number): void {}

View File

@ -3,8 +3,8 @@ import {Plugin, Cordova} from './plugin';
export interface CalendarOptions {
firstReminderMinutes?: number;
secondReminderMinutes?: number;
recurrence?: string, // options are: 'daily', 'weekly', 'monthly', 'yearly'
recurrenceInterval?: number, // only used when recurrence is set
recurrence?: string; // options are: 'daily', 'weekly', 'monthly', 'yearly'
recurrenceInterval?: number; // only used when recurrence is set
recurrenceEndDate?: Date;
calendarName?: string;
calendarId?: number;
@ -12,8 +12,8 @@ export interface CalendarOptions {
}
export interface Calendar {
id: number,
name: string
id: number;
name: string;
}
/**
@ -30,7 +30,7 @@ export interface Calendar {
plugin: 'cordova-plugin-calendar',
pluginRef: 'plugins.calendar',
repo: 'https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin',
platforms: ['Android','iOS']
platforms: ['Android', 'iOS']
})
export class Calendar {
/**
@ -57,7 +57,7 @@ export class Calendar {
@Cordova()
static createCalendar(
nameOrOptions: string | { calendarName: string, calendarColor: string }
): Promise<any> { return }
): Promise<any> { return; }
/**
* Delete a calendar. (iOS only)
@ -74,7 +74,7 @@ export class Calendar {
* @return Returns a Promise
*/
@Cordova()
static deleteCalendar(name: string): Promise<any> { return }
static deleteCalendar(name: string): Promise<any> { return; }
/**
* Returns the default calendar options.
@ -102,7 +102,7 @@ export class Calendar {
calendarName: null,
calendarId: null,
url: null
}
};
}
/**
@ -122,7 +122,7 @@ export class Calendar {
notes?: string,
startDate?: Date,
endDate?: Date
): Promise<any> { return }
): Promise<any> { return; }
/**
* Silently create an event with additional options.
@ -143,7 +143,7 @@ export class Calendar {
startDate?: Date,
endDate?: Date,
options?: CalendarOptions
): Promise<any> { return }
): Promise<any> { return; }
/**
* Interactively create an event.
@ -162,7 +162,7 @@ export class Calendar {
notes?: string,
startDate?: Date,
endDate?: Date
): Promise<any> { return }
): Promise<any> { return; }
/**
* Interactively create an event with additional options.
@ -177,13 +177,13 @@ export class Calendar {
*/
@Cordova()
static createEventInteractivelyWithOptions(
title?:string,
title?: string,
location?: string,
notes?: string,
startDate?: Date,
endDate?: Date,
options?: CalendarOptions
): Promise<any> { return }
): Promise<any> { return; }
// deprecated
// @Cordova()
@ -213,7 +213,7 @@ export class Calendar {
notes?: string,
startDate?: Date,
endDate?: Date
): Promise<any> { return }
): Promise<any> { return; }
/**
* Find an event with additional options.
@ -234,7 +234,7 @@ export class Calendar {
startDate?: Date,
endDate?: Date,
options?: CalendarOptions
): Promise<any> { return }
): Promise<any> { return; }
/**
* Find a list of events within the specified date range. (Android only)
@ -244,21 +244,21 @@ export class Calendar {
* @return Returns a Promise that resolves with the list of events, or rejects with an error.
*/
@Cordova()
static listEventsInRange(startDate: Date, endDate: Date): Promise<any> { return }
static listEventsInRange(startDate: Date, endDate: Date): Promise<any> { return; }
/**
* Get a list of all calendars.
* @return A Promise that resolves with the list of calendars, or rejects with an error.
*/
@Cordova()
static listCalendars(){ return }
static listCalendars() { return; }
/**
* Get a list of all future events in the specified calendar. (iOS only)
* @return Returns a Promise that resolves with the list of events, or rejects with an error.
*/
@Cordova()
static findAllEventsInNamedCalendar(calendarName: string): Promise<any> { return }
static findAllEventsInNamedCalendar(calendarName: string): Promise<any> { return; }
/**
* Modify an event. (iOS only)
@ -287,7 +287,7 @@ export class Calendar {
newNotes?: string,
newStartDate?: Date,
newEndDate?: Date
): Promise<any> { return }
): Promise<any> { return; }
/**
* Modify an event with additional options. (iOS only)
@ -318,7 +318,7 @@ export class Calendar {
newStartDate?: Date,
newEndDate?: Date,
options?: CalendarOptions
) { return }
) { return; }
/**
* Delete an event.
@ -337,7 +337,7 @@ export class Calendar {
notes?: string,
startDate?: Date,
endDate?: Date
): Promise<any> { return }
): Promise<any> { return; }
/**
* Delete an event from the specified Calendar. (iOS only)
@ -358,12 +358,12 @@ export class Calendar {
startDate?: Date,
endDate?: Date,
calendarName?: string
): Promise<any> { return }
): Promise<any> { return; }
/**
* Open the calendar at the specified date.
* @return {Date} date
*/
@Cordova()
static openCalendar(date: Date): Promise<any> { return }
static openCalendar(date: Date): Promise<any> { return; }
}

View File

@ -82,7 +82,7 @@ export interface CameraPopoverOptions {
* ARROW_RIGHT : 8,
* ARROW_ANY : 15
*/
arrowDir : number;
arrowDir: number;
}
/**
@ -108,7 +108,7 @@ export interface CameraPopoverOptions {
plugin: 'cordova-plugin-camera',
pluginRef: 'navigator.camera',
repo: 'https://github.com/apache/cordova-plugin-camera',
platforms: ['Android','BlackBerry','Browser','Firefox','FireOS','iOS','Windows','Windows Phone 8','Ubuntu']
platforms: ['Android', 'BlackBerry', 'Browser', 'Firefox', 'FireOS', 'iOS', 'Windows', 'Windows Phone 8', 'Ubuntu']
})
export class Camera {
/**
@ -119,7 +119,7 @@ export class Camera {
@Cordova({
callbackOrder: 'reverse'
})
static getPicture(options: CameraOptions): Promise<any> { return }
static getPicture(options: CameraOptions): Promise<any> { return; }
/**
* Remove intermediate image files that are kept in temporary storage after calling camera.getPicture.
@ -129,7 +129,7 @@ export class Camera {
@Cordova({
platforms: ['iOS']
})
static cleanup(){};
static cleanup() { };
/**
* @enum {number}

View File

@ -41,13 +41,13 @@ export class Clipboard {
* @returns {Promise<T>}
*/
@Cordova()
static copy(text: string): Promise<any> { return }
static copy(text: string): Promise<any> { return; }
/**
* Pastes the text stored in clipboard
* @returns {Promise<T>}
*/
@Cordova()
static paste(): Promise<any> { return }
static paste(): Promise<any> { return; }
}

View File

@ -224,7 +224,7 @@ export class Contacts {
@Cordova({
sync: true
})
static create(options: ContactProperties){
static create(options: ContactProperties) {
return new Contact();
};
@ -249,7 +249,7 @@ export class Contacts {
successIndex: 1,
errorIndex: 2
})
static find(fields: string[], options?: any): Promise<any> { return }
static find(fields: string[], options?: any): Promise<any> { return; }
/**
@ -257,5 +257,5 @@ export class Contacts {
* @return Returns a Promise that resolves with the selected Contact
*/
@Cordova()
static pickContact(): Promise<any> { return }
static pickContact(): Promise<any> { return; }
}

View File

@ -1,18 +1,18 @@
import {Plugin, Cordova} from './plugin';
export interface datePickerOptions {
export interface DatePickerOptions {
/**
* Platforms: iOS, Android, Windows
* The mode of the date picker
* Values: date | time | datetime
*/
mode: string,
mode: string;
/**
* Platforms: iOS, Android, Windows
* Selected date
*/
date: Date,
date: Date;
/**
* Platforms: iOS, Android, Windows
@ -20,7 +20,7 @@ export interface datePickerOptions {
* Type: Date | empty String
* Default: empty String
*/
minDate?: Date,
minDate?: Date;
/**
* Platforms?: iOS, Android, Windows
@ -28,7 +28,7 @@ export interface datePickerOptions {
* Type?: Date | empty String
* Default?: empty String
*/
maxDate?: Date,
maxDate?: Date;
/**
* Platforms?: Android
@ -36,31 +36,31 @@ export interface datePickerOptions {
* Type?: String
* Default?: empty String
*/
titleText?: string,
titleText?: string;
/**
* Platforms?: Android
* Label of BUTTON_POSITIVE (done button) on Android
*/
okText?: string,
okText?: string;
// TODO complete documentation here, and copy params & docs to main plugin docs
cancelText?: string,
todayText?: string,
nowText?: string,
is24Hour?: boolean,
androidTheme?: number,
allowOldDate?: boolean,
allowFutureDates?: boolean,
doneButtonLabel?: string,
doneButtonColor?: string,
cancelButtonLabel?: string,
cancelButtonColor?: string,
x?: number,
y?: number,
minuteInterval?: number,
popoverArrowDirection?: string,
locale?: string
cancelText?: string;
todayText?: string;
nowText?: string;
is24Hour?: boolean;
androidTheme?: number;
allowOldDate?: boolean;
allowFutureDates?: boolean;
doneButtonLabel?: string;
doneButtonColor?: string;
cancelButtonLabel?: string;
cancelButtonColor?: string;
x?: number;
y?: number;
minuteInterval?: number;
popoverArrowDirection?: string;
locale?: string;
}
/**
@ -101,6 +101,6 @@ export class DatePicker {
* @returns {Promise<Date>} Returns a promise that resolves with the picked date and/or time, or rejects with an error.
*/
@Cordova()
static show(options: datePickerOptions): Promise<Date> { return }
static show(options: DatePickerOptions): Promise<Date> { return; }
}

View File

@ -1,5 +1,5 @@
import {Plugin, Cordova} from './plugin'
import {Observable} from "rxjs/Observable";
import {Plugin, Cordova} from './plugin';
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.
@ -33,7 +33,7 @@ import {Observable} from "rxjs/Observable";
plugin: 'cordova-plugin-dbmeter',
pluginRef: 'DBMeter',
repo: 'https://github.com/akofman/cordova-plugin-dbmeter',
platforms: ['iOS','Android']
platforms: ['iOS', 'Android']
})
export class DBMeter {
@ -45,27 +45,27 @@ export class DBMeter {
observable: true,
clearFunction: 'stop'
})
static start () : Observable<any> {return}
static start (): Observable<any> {return; }
/**
* Stops listening
* @private
*/
@Cordova()
static stop () : Promise<any> {return}
static stop (): Promise<any> {return; }
/**
* Check if the DB Meter is listening
* @return {Promise<boolean>} Returns a promise that resolves with a boolean that tells us whether the DB meter is listening
*/
@Cordova()
static isListening() : Promise<boolean> {return}
static isListening(): Promise<boolean> {return; }
/**
* Delete the DB Meter instance
* @return {Promise<any>} Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur.
*/
@Cordova()
static delete() : Promise<any> {return}
static delete(): Promise<any> {return; }
}

View File

@ -18,12 +18,12 @@ export interface Device {
uuid: string;
/** Get the operating system version. */
version: string;
/** Get the device's manufacturer. */
manufacturer: string;
/** Whether the device is running on a simulator. */
isVirtual: boolean;
/** Get the device hardware serial number. */
serial: string;
/** Get the device's manufacturer. */
manufacturer: string;
/** Whether the device is running on a simulator. */
isVirtual: boolean;
/** Get the device hardware serial number. */
serial: string;
}
/**
@ -47,11 +47,11 @@ export interface Device {
})
export class Device {
/**
* Returns the whole device object.
*
* @returns {Object} The device object.
*/
/**
* Returns the whole device object.
*
* @returns {Object} The device object.
*/
@CordovaProperty
static get device() { return window.device; }
}

View File

@ -11,23 +11,23 @@ export class DeviceAccounts {
* Gets all accounts registered on the Android Device
*/
@Cordova()
static get() : Promise<any> {return}
static get(): Promise<any> {return; }
/**
* Get all accounts registered on Android device for requested type
*/
@Cordova()
static getByType(type: string) : Promise<any> {return}
static getByType(type: string): Promise<any> {return; }
/**
* Get all emails registered on Android device (accounts with 'com.google' type)
*/
@Cordova()
static getEmails() : Promise<any> {return}
static getEmails(): Promise<any> {return; }
/**
* Get the first email registered on Android device
*/
@Cordova()
static getEmail() : Promise<any> {return}
static getEmail(): Promise<any> {return; }
}

View File

@ -1,36 +1,36 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from "rxjs/Observable";
import {Observable} from 'rxjs/Observable';
export interface accelerationData {
export interface AccelerationData {
/**
* Amount of acceleration on the x-axis. (in m/s^2)
*/
x : number,
x: number;
/**
* Amount of acceleration on the y-axis. (in m/s^2)
*/
y : number,
y: number;
/**
* Amount of acceleration on the z-axis. (in m/s^2)
*/
z : number,
z: number;
/**
* Creation timestamp in milliseconds.
*/
timestamp : any
timestamp: any;
}
export interface accelerometerOptions {
export interface AccelerometerOptions {
/**
* Requested period of calls to accelerometerSuccess with acceleration data in Milliseconds. Default: 10000
*/
frequency? : number
frequency?: number;
}
@ -74,7 +74,9 @@ export class DeviceMotion {
* @returns {Promise<any>} Returns object with x, y, z, and timestamp properties
*/
@Cordova()
static getCurrentAcceleration(): Promise<accelerationData> { return }
static getCurrentAcceleration(): Promise<AccelerationData> {
return;
}
/**
* Watch the device acceleration. Clear the watch by unsubscribing from the observable.
@ -89,12 +91,14 @@ export class DeviceMotion {
* subscription.unsubscribe();
* ```
* @param options
* @returns {Observable<accelerationData>}
* @returns {Observable<AccelerationData>}
*/
@Cordova({
callbackOrder: 'reverse',
observable: true,
clearFunction: 'clearWatch'
})
static watchAcceleration (options?: accelerometerOptions): Observable<accelerationData> { return }
}
static watchAcceleration(options?: AccelerometerOptions): Observable<AccelerationData> {
return;
}
}

View File

@ -1,27 +1,27 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from "rxjs/Observable";
import {Observable} from 'rxjs/Observable';
export interface CompassHeading {
/**
* The heading in degrees from 0-359.99 at a single moment in time. (Number)
*/
magneticHeading : number,
magneticHeading: number;
/**
* The heading relative to the geographic North Pole in degrees 0-359.99 at a single moment in time. A negative value indicates that the true heading can't be determined. (Number)
*/
trueHeading : number,
trueHeading: number;
/**
* The deviation in degrees between the reported heading and the true heading. (Number)
*/
headingAccuracy : number,
headingAccuracy: number;
/**
* The time at which this heading was determined. (DOMTimeStamp)
*/
timestamp : any
timestamp: any;
}
@ -30,12 +30,12 @@ export interface CompassOptions {
/**
* How often to retrieve the compass heading in milliseconds. (Number) (Default: 100)
*/
frequency? : number,
frequency?: number;
/**
* The change in degrees required to initiate a watchHeading success callback. When this value is set, frequency is ignored. (Number)
*/
filter? : number
filter?: number;
}
@ -77,7 +77,7 @@ export class DeviceOrientation {
* @returns {Promise<CompassHeading>}
*/
@Cordova()
static getCurrentHeading(): Promise<CompassHeading> { return }
static getCurrentHeading(): Promise<CompassHeading> { return; }
/**
* Get the device current heading at a regular interval
@ -91,6 +91,6 @@ export class DeviceOrientation {
observable: true,
cancelFunction: 'clearWatch'
})
static watchHeading(options?: CompassOptions): Observable<CompassHeading> { return }
static watchHeading(options?: CompassOptions): Observable<CompassHeading> { return; }
}

View File

@ -5,184 +5,184 @@ import {Plugin, Cordova} from './plugin';
pluginRef: 'cordova.plugins.diagnostic'
})
export class Diagnostic {
/**
/**
* Checks if app is able to access device location.
*/
@Cordova()
static isLocationEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/**
* Checks if Wifi is connected/enabled. On iOS this returns true if the device is connected to a network by WiFi. On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled.
* On Android this requires permission <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
*/
@Cordova()
static isWifiEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/*
* Checks if the device has a camera. On Android this returns true if the device has a camera. On iOS this returns true if both the device has a camera AND the application is authorized to use it. On Windows 10 Mobile this returns true if both the device has a rear-facing camera AND the
* application is authorized to use it.
*/
@Cordova()
static isCameraEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/*
* Checks if the device has Bluetooth capabilities and if so that Bluetooth is switched on (same on Android, iOS and Windows 10 Mobile)
* On Android this requires permission <uses-permission android:name="android.permission.BLUETOOTH" />
*/
@Cordova()
static isBluetoothEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/*
* Returns the location authorization status for the application.
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
*
* mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use".
*/
@Cordova()
static requestLocationAuthorization(mode?:string) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<string>((res, rej) => {});
}
/*
* Checks if the application is authorized to use location.
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
*/
@Cordova()
static isLocationAuthorized() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/*
* Checks if camera hardware is present on device.
*/
@Cordova()
static isCameraPresent() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/*
* Checks if the application is authorized to use the camera.
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time.
*/
@Cordova()
static isCameraAuthorized() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/*
* Checks if location mode is set to return high-accuracy locations from GPS hardware.
* Returns true if Location mode is enabled and is set to either:
* - Device only = GPS hardware only (high accuracy)
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
*/
@Cordova()
static isGpsLocationEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/*
* Checks if location mode is set to return low-accuracy locations from network triangulation/WiFi access points.
* Returns true if Location mode is enabled and is set to either:
* - Battery saving = network triangulation and Wifi network IDs (low accuracy)
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
*/
@Cordova()
static isNetworkLocationEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/**
*
* Checks if remote (push) notifications are enabled.
* On iOS 8+, returns true if app is registered for remote notifications AND "Allow Notifications" switch is ON AND alert style is not set to "None" (i.e. "Banners" or "Alerts").
* On iOS <=7, returns true if app is registered for remote notifications AND alert style is not set to "None" (i.e. "Banners" or "Alerts") - same as isRegisteredForRemoteNotifications().
*/
@Cordova()
static isRemoteNotificationsEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/**
*
* Indicates if the app is registered for remote (push) notifications on the device.
* On iOS 8+, returns true if the app is registered for remote notifications and received its device token, or false if registration has not occurred, has failed, or has been denied by the user. Note that user preferences for notifications in the Settings app will not affect this.
* On iOS <=7, returns true if app is registered for remote notifications AND alert style is not set to "None" (i.e. "Banners" or "Alerts") - same as isRemoteNotificationsEnabled().
*/
@Cordova()
static isRegisteredForRemoteNotifications() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
@Cordova()
static isLocationEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/**
* Checks if Wifi is connected/enabled. On iOS this returns true if the device is connected to a network by WiFi. On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled.
* On Android this requires permission <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
*/
@Cordova()
static isWifiEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/*
* Checks if the device has a camera. On Android this returns true if the device has a camera. On iOS this returns true if both the device has a camera AND the application is authorized to use it. On Windows 10 Mobile this returns true if both the device has a rear-facing camera AND the
* application is authorized to use it.
*/
@Cordova()
static isCameraEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/*
* Checks if the device has Bluetooth capabilities and if so that Bluetooth is switched on (same on Android, iOS and Windows 10 Mobile)
* On Android this requires permission <uses-permission android:name="android.permission.BLUETOOTH" />
*/
@Cordova()
static isBluetoothEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/*
* Returns the location authorization status for the application.
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
*
* mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use".
*/
@Cordova()
static requestLocationAuthorization(mode?: string) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<string>((res, rej) => {});
}
/*
* Checks if the application is authorized to use location.
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
*/
@Cordova()
static isLocationAuthorized() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/*
* Checks if camera hardware is present on device.
*/
@Cordova()
static isCameraPresent() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/*
* Checks if the application is authorized to use the camera.
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time.
*/
@Cordova()
static isCameraAuthorized() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/*
* Checks if location mode is set to return high-accuracy locations from GPS hardware.
* Returns true if Location mode is enabled and is set to either:
* - Device only = GPS hardware only (high accuracy)
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
*/
@Cordova()
static isGpsLocationEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/*
* Checks if location mode is set to return low-accuracy locations from network triangulation/WiFi access points.
* Returns true if Location mode is enabled and is set to either:
* - Battery saving = network triangulation and Wifi network IDs (low accuracy)
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
*/
@Cordova()
static isNetworkLocationEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/**
*
* Checks if remote (push) notifications are enabled.
* On iOS 8+, returns true if app is registered for remote notifications AND "Allow Notifications" switch is ON AND alert style is not set to "None" (i.e. "Banners" or "Alerts").
* On iOS <=7, returns true if app is registered for remote notifications AND alert style is not set to "None" (i.e. "Banners" or "Alerts") - same as isRegisteredForRemoteNotifications().
*/
@Cordova()
static isRemoteNotificationsEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/**
*
* Indicates if the app is registered for remote (push) notifications on the device.
* On iOS 8+, returns true if the app is registered for remote notifications and received its device token, or false if registration has not occurred, has failed, or has been denied by the user. Note that user preferences for notifications in the Settings app will not affect this.
* On iOS <=7, returns true if app is registered for remote notifications AND alert style is not set to "None" (i.e. "Banners" or "Alerts") - same as isRemoteNotificationsEnabled().
*/
@Cordova()
static isRegisteredForRemoteNotifications() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
}

View File

@ -1,16 +1,16 @@
import {Plugin, Cordova} from './plugin';
export interface promptCallback {
export interface PromptCallback {
/**
* The index of the pressed button. (Number) Note that the index uses one-based indexing, so the value is 1, 2, 3, etc.
*/
buttonIndex : number,
buttonIndex: number;
/**
* The text entered in the prompt dialog box. (String)
*/
input1 : string
input1: string;
}
@ -53,7 +53,7 @@ export class Dialogs {
message,
title: string = 'Alert',
buttonName: string = 'OK'
): Promise<any>{ return }
): Promise<any> {return; }
/**
* Displays a customizable confirmation dialog box.
@ -70,7 +70,7 @@ export class Dialogs {
message,
title: string = 'Confirm',
buttonLabels: Array<string> = ['OK', 'Cancel']
): Promise<number>{ return }
): Promise<number> { return; }
/**
* Displays a native dialog box that is more customizable than the browser's prompt function.
@ -89,7 +89,7 @@ export class Dialogs {
title: string = 'Prompt',
buttonLabels: Array<string> = ['OK', 'Cancel'],
defaultText: string = ''
): Promise<any>{ return }
): Promise<any> { return; }
/**

View File

@ -5,15 +5,15 @@ declare var cordova;
/**
* Email object for Opening Email Composer
*/
export interface email {
app?: string,
to: string | Array<string>,
cc: string | Array<string>,
bcc: string | Array<string>,
attachments: Array<any>,
subject: string,
body: string,
isHtml: boolean
export interface Email {
app?: string;
to: string | Array<string>;
cc: string | Array<string>;
bcc: string | Array<string>;
attachments: Array<any>;
subject: string;
body: string;
isHtml: boolean;
}
/**
@ -26,7 +26,7 @@ export interface email {
* ```ts
* import {EmailComposer} from 'ionic-native';
*
*
*
* EmailComposer.isAvailable().then((available) =>{
* if(available) {
* //Now we know we can send
@ -60,15 +60,15 @@ export interface email {
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
export class EmailComposer {
/**
/**
* Verifies if sending emails is supported on the device.
*
*
* @param app {string?} An optional app id or uri scheme. Defaults to mailto.
* @param scope {any?} An optional scope for the promise
* @returns {Promise<boolean>} Resolves promise with boolean whether EmailComposer is available
*/
static isAvailable (app? : string, scope? : any) : Promise<boolean> {
static isAvailable (app?: string, scope?: any): Promise<boolean> {
return new Promise<boolean>((resolve, reject) => {
cordova.plugins.email.isAvailable(app, resolve, scope);
});
@ -81,12 +81,12 @@ export class EmailComposer {
* @param packageName {string} The package name
*/
@Cordova()
static addAlias(alias : string, packageName : string): void {}
static addAlias(alias: string, packageName: string): void {}
/**
* Displays the email composer pre-filled with data.
*
* @param email {email} Email
*
* @param email {Email} Email
* @param scope {any?} An optional scope for the promise
* @returns {Promise<any>} Resolves promise when the EmailComposer has been opened
*/
@ -94,6 +94,6 @@ export class EmailComposer {
successIndex: 1,
errorIndex: 3
})
static open(email : email, scope? : any) : Promise<any> {return}
static open(email: Email, scope?: any): Promise<any> {return; }
}

View File

@ -111,7 +111,7 @@ export class Facebook {
* @return Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails.
*/
@Cordova()
static login(permissions: string[]): Promise<any> { return }
static login(permissions: string[]): Promise<any> { return; }
/**
* Logout of Facebook.
@ -120,7 +120,7 @@ export class Facebook {
* @return Returns a Promise that resolves on a successful logout, and rejects if logout fails.
*/
@Cordova()
static logout(): Promise<any> { return }
static logout(): Promise<any> { return; }
/**
* Determine if a user is logged in to Facebook and has authenticated your app. There are three possible states for a user:
@ -149,7 +149,7 @@ export class Facebook {
* @return Returns a Promise that resolves with a status, or rejects with an error
*/
@Cordova()
static getLoginStatus(): Promise<any> { return }
static getLoginStatus(): Promise<any> { return; }
/**
* Get a Facebook access token for using Facebook services.
@ -157,7 +157,7 @@ export class Facebook {
* @return Returns a Promise that resolves with an access token, or rejects with an error
*/
@Cordova()
static getAccessToken(): Promise<string> { return }
static getAccessToken(): Promise<string> { return; }
/**
* Show one of various Facebook dialogs. Example of options for a Share dialog:
@ -177,7 +177,7 @@ export class Facebook {
* @return Returns a Promise that resolves with success data, or rejects with an error
*/
@Cordova()
static showDialog(options: any): Promise<any> { return }
static showDialog(options: any): Promise<any> { return; }
/**
* Make a call to Facebook Graph API. Can take additional permissions beyond those granted on login.
@ -193,7 +193,7 @@ export class Facebook {
* @return Returns a Promise that resolves with the result of the request, or rejects with an error
*/
@Cordova()
static api(requestPath: string, permissions: string[]): Promise<any> { return }
static api(requestPath: string, permissions: string[]): Promise<any> { return; }
/**
* Log an event. For more information see the Events section above.
@ -208,7 +208,7 @@ export class Facebook {
name: string,
params?: Object,
valueToSum?: number
): Promise<any> { return }
): Promise<any> { return; }
/**
* Log a purchase. For more information see the Events section above.
@ -218,7 +218,7 @@ export class Facebook {
* @return Returns a Promise
*/
@Cordova()
static logPurchase(value: number, currency: string): Promise<any> { return }
static logPurchase(value: number, currency: string): Promise<any> { return; }
/**
* Open App Invite dialog. Does not require login.
@ -239,5 +239,5 @@ export class Facebook {
static appInvite(options: {
url: string,
picture: string
}): Promise<any> { return }
}): Promise<any> { return; }
}

View File

@ -45,7 +45,7 @@ export class File {
*/
static checkDir(path: string, dir: string): Promise<any> {
let resolveFn, rejectFn;
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; })
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; });
if ((/^\//.test(dir))) {
rejectFn('directory cannot start with \/');
@ -84,13 +84,13 @@ export class File {
*/
static createDir(path: string, dirName: string, replace: boolean): Promise<any> {
let resolveFn, rejectFn;
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; })
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; });
if ((/^\//.test(dirName))) {
rejectFn('directory cannot start with \/');
}
replace = replace ? false : true;
replace = !replace;
var options = {
create: true,
@ -126,7 +126,7 @@ export class File {
*/
static removeDir(path: string, dirName: string): Promise<any> {
let resolveFn, rejectFn;
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; })
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; });
if ((/^\//.test(dirName))) {
rejectFn('directory cannot start with \/');
@ -137,7 +137,7 @@ export class File {
fileSystem.getDirectory(dirName, {create: false}, function (dirEntry) {
dirEntry.remove(function () {
resolveFn({success: true, fileRemoved: dirEntry});
}, function (error) {
}, function (error: any) {
error.message = File.cordovaFileError[error.code];
rejectFn(error);
});
@ -168,7 +168,7 @@ export class File {
*/
static moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<any> {
let resolveFn, rejectFn;
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; })
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; });
newDirName = newDirName || dirName;
@ -212,7 +212,7 @@ export class File {
*/
static copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise<any> {
let resolveFn, rejectFn;
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; })
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; });
newDirName = newDirName || dirName;
@ -260,7 +260,7 @@ export class File {
*/
static listDir(path: string, dirName: string): Promise<any> {
let resolveFn, rejectFn;
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; })
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; });
if ((/^\//.test(dirName))) {
rejectFn('directory cannot start with \/');
@ -305,7 +305,7 @@ export class File {
*/
static removeRecursively(path: string, dirName: string): Promise<any> {
let resolveFn, rejectFn;
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; })
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; });
if ((/^\//.test(dirName))) {
rejectFn('directory cannot start with \/');
@ -345,7 +345,7 @@ export class File {
*/
static checkFile(path: string, file: string): Promise<any> {
let resolveFn, rejectFn;
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; })
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; });
if ((/^\//.test(file))) {
rejectFn('file cannot start with \/');
@ -384,14 +384,14 @@ export class File {
*/
static createFile(path: string, fileName: string, replace: boolean): Promise<any> {
let resolveFn, rejectFn;
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; })
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; });
if ((/^\//.test(fileName))) {
rejectFn('file-name cannot start with \/');
}
replace = replace ? false : true;
replace = !replace;
var options = {
create: true,
@ -427,7 +427,7 @@ export class File {
*/
static removeFile(path: string, fileName: string): Promise<any> {
let resolveFn, rejectFn;
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; })
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; });
if ((/^\//.test(fileName))) {
rejectFn('file-name cannot start with \/');
@ -438,7 +438,7 @@ export class File {
fileSystem.getFile(fileName, {create: false}, function (fileEntry) {
fileEntry.remove(function () {
resolveFn({success: true, fileRemoved: fileEntry});
}, function (error) {
}, function (error: any) {
error.message = File.cordovaFileError[error.code];
rejectFn(error);
});
@ -481,9 +481,9 @@ export class File {
*/
static moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<any> {
let resolveFn, rejectFn;
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; })
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; });
newFileName = newFileName || fileName
newFileName = newFileName || fileName;
if ((/^\//.test(newFileName))) {
rejectFn('file-name cannot start with \/');
@ -525,9 +525,9 @@ export class File {
*/
static copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise<any> {
let resolveFn, rejectFn;
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; })
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; });
newFileName = newFileName || fileName
newFileName = newFileName || fileName;
if ((/^\//.test(newFileName))) {
rejectFn('file-name cannot start with \/');

View File

@ -27,28 +27,28 @@ export class Flashlight {
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean stating if the flash light is available.
*/
@Cordova()
static available(): Promise<boolean> { return }
static available(): Promise<boolean> { return; }
/**
* Switches the flashlight on
* @returns {Promise<boolean>}
*/
@Cordova()
static switchOn(): Promise<boolean> { return }
static switchOn(): Promise<boolean> { return; }
/**
* Switches the flash light off
* @returns {Promise<boolean>}
*/
@Cordova()
static switchOff(): Promise<boolean> { return }
static switchOff(): Promise<boolean> { return; }
/**
* Toggles the flashlight
* @returns {Promise<any>}
*/
@Cordova()
static toggle(): Promise<any> { return }
static toggle(): Promise<any> { return; }
/**
@ -58,6 +58,6 @@ export class Flashlight {
@Cordova({
sync: true
})
static isSwitchedOn(): boolean { return }
static isSwitchedOn(): boolean { return; }
}

View File

@ -133,7 +133,7 @@ export class Geolocation {
@Cordova({
callbackOrder: 'reverse'
})
static getCurrentPosition(options?: GeolocationOptions): Promise<Geoposition> { return }
static getCurrentPosition(options?: GeolocationOptions): Promise<Geoposition> { return; }
/**
* Watch the current device's position. Clear the watch by unsubscribing from
@ -156,5 +156,5 @@ export class Geolocation {
observable: true,
clearFunction: 'clearWatch'
})
static watchPosition(options?: GeolocationOptions): Observable<Geoposition> { return }
static watchPosition(options?: GeolocationOptions): Observable<Geoposition> { return; }
}

View File

@ -12,37 +12,37 @@ import {Plugin, Cordova} from './plugin';
* ```
*/
@Plugin({
plugin: 'cordova-plugin-globalization',
pluginRef: 'navigator.globalization',
repo: 'https://github.com/apache/cordova-plugin-globalization'
plugin: 'cordova-plugin-globalization',
pluginRef: 'navigator.globalization',
repo: 'https: //github.com/apache/cordova-plugin-globalization'
})
export class Globalization {
/**
* Returns the BCP-47 compliant language identifier tag to the successCallback with a properties object as a parameter. That object should have a value property with a String value.
* @return {Promise<{value:string}>}
* @return {Promise<{value: string}>}
*/
@Cordova()
static getPreferredLanguage() : Promise<{value:string}> {return}
static getPreferredLanguage(): Promise<{value: string}> {return; }
/**
* Returns the BCP 47 compliant locale identifier string to the successCallback with a properties object as a parameter.
* @return {Promise<{value:string}>}
* @return {Promise<{value: string}>}
*/
@Cordova()
static getLocaleName() : Promise<{value:string}> {return}
static getLocaleName(): Promise<{value: string}> {return; }
/**
* Converts date to string
* @param date
* @param options
* @return {Promise<{value:string}>}
* @return {Promise<{value: string}>}
*/
@Cordova({
successIndex: 1,
errorIndex: 2
successIndex: 1,
errorIndex: 2
})
static dateToString(date : Date, options : {formatLength:string, selector:string}) : Promise<{value:string}> {return}
static dateToString(date: Date, options: {formatLength: string, selector: string}): Promise<{value: string}> {return; }
/**
*
@ -50,10 +50,10 @@ export class Globalization {
* @param options
*/
@Cordova({
successIndex: 1,
errorIndex: 2
successIndex: 1,
errorIndex: 2
})
static stringToDate(dateString:string, options:{formatLength:string, selector:string}) : Promise<{year : number, month : number, day:number, hour:number, minute:number, second:number, millisecond:number}> {return}
static stringToDate(dateString: string, options: {formatLength: string, selector: string}): Promise<{year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number}> {return; }
/**
@ -61,9 +61,9 @@ export class Globalization {
* @param options
*/
@Cordova({
callbackOrder: 'reverse'
callbackOrder: 'reverse'
})
static getDatePattern(options:{formatLength:string, selector:string}) : Promise<{pattern:string}> {return}
static getDatePattern(options: {formatLength: string, selector: string}): Promise<{pattern: string}> {return; }
/**
@ -71,58 +71,58 @@ export class Globalization {
* @param options
*/
@Cordova({
callbackOrder: 'reverse'
callbackOrder: 'reverse'
})
static getDateNames(options:{type:string,item:string}) : Promise<{value:Array<string>}> {return}
static getDateNames(options: {type: string, item: string}): Promise<{value: Array<string>}> {return; }
/**
* Check if day light saving is active
* @param date
*/
@Cordova()
static isDayLightSavingsTime(date:Date) : Promise<{dst:string}> {return}
static isDayLightSavingsTime(date: Date): Promise<{dst: string}> {return; }
/**
* Get first day of week
*/
@Cordova()
static getFirstDayOfWeek() : Promise<{value:string}> {return}
static getFirstDayOfWeek(): Promise<{value: string}> {return; }
/**
*
* @param options
*/
@Cordova({
successIndex: 1,
errorIndex: 2
successIndex: 1,
errorIndex: 2
})
static numberToString(options:{type:string}) : Promise<{value:string}> {return}
static numberToString(options: {type: string}): Promise<{value: string}> {return; }
/**
*
* @param string
* @param stringToConvert
* @param options
*/
@Cordova({
successIndex: 1,
errorIndex: 2
successIndex: 1,
errorIndex: 2
})
static stringToNumber(string:string, options:{type:string}) :Promise<{value}> {return}
static stringToNumber(stringToConvert: string, options: {type: string}): Promise<{value}> {return; }
/**
*
* @param options
*/
@Cordova({
callbackOrder: 'reverse'
callbackOrder: 'reverse'
})
static getNumberPattern(options:{type:string}) : Promise<{pattern:string, symbol:string, fraction:number, rounding:number, positive:string, negative:string, decimal:string, grouping:string}> {return}
static getNumberPattern(options: {type: string}): Promise<{pattern: string, symbol: string, fraction: number, rounding: number, positive: string, negative: string, decimal: string, grouping: string}> {return; }
/**
*
* @param currencyCode
*/
@Cordova()
static getCurrencyPattern(currencyCode:string) : Promise<{pattern:string, code:string, fraction:number, rounding:number, decimal:number, grouping:string}> {return}
static getCurrencyPattern(currencyCode: string): Promise<{pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string}> {return; }
}

View File

@ -24,17 +24,17 @@ export class GoogleAnalytics {
* @param {string} id Your Google Analytics Mobile App property
*/
@Cordova()
static startTrackerWithId(id: string): Promise<any> { return }
static startTrackerWithId(id: string): Promise<any> { return; }
/**
* Track a screen
* https://developers.google.com/analytics/devguides/collection/analyticsjs/screens
*
*
* @param {string} title Screen title
*/
@Cordova()
static trackView(title: string): Promise<any> { return }
static trackView(title: string): Promise<any> { return; }
/**
* Track an event
* https://developers.google.com/analytics/devguides/collection/analyticsjs/events
@ -44,16 +44,16 @@ export class GoogleAnalytics {
* @param {number} value
*/
@Cordova()
static trackEvent(category: string, action: string, label?: string, value?: number): Promise<any> { return }
static trackEvent(category: string, action: string, label?: string, value?: number): Promise<any> { return; }
/**
* Track an exception
* @param {string} description
* @param {boolean} fatal
*/
@Cordova()
static trackException(description: string, fatal: boolean): Promise<any> { return }
static trackException(description: string, fatal: boolean): Promise<any> { return; }
/**
* Track User Timing (App Speed)
* @param {string} category
@ -62,8 +62,8 @@ export class GoogleAnalytics {
* @param {string} label
*/
@Cordova()
static trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise<any> { return }
static trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise<any> { return; }
/**
* Add a Transaction (Ecommerce)
* https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addTrans
@ -75,8 +75,8 @@ export class GoogleAnalytics {
* @param {string} currencyCode
*/
@Cordova()
static addTransaction(id: string, affiliation: string, revenue: number, tax: number, shipping: number, currencyCode: string): Promise<any> { return }
static addTransaction(id: string, affiliation: string, revenue: number, tax: number, shipping: number, currencyCode: string): Promise<any> { return; }
/**
* Add a Transaction Item (Ecommerce)
* https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addItem
@ -89,8 +89,8 @@ export class GoogleAnalytics {
* @param {string} currencyCode
*/
@Cordova()
static addTransactionItem(id: string, name: string, sku: string, category: string, price: number, quantity: number, currencyCode: string): Promise<any> { return }
static addTransactionItem(id: string, name: string, sku: string, category: string, price: number, quantity: number, currencyCode: string): Promise<any> { return; }
/**
* Add a Custom Dimension
* https://developers.google.com/analytics/devguides/platform/customdimsmets
@ -98,26 +98,26 @@ export class GoogleAnalytics {
* @param {string} value
*/
@Cordova()
static addCustomDimension(key: number, value: string): Promise<any> { return }
static addCustomDimension(key: number, value: string): Promise<any> { return; }
/**
* Set a UserId
* https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id
* @param {string} id
*/
@Cordova()
static setUserId(id: string): Promise<any> { return }
static setUserId(id: string): Promise<any> { return; }
/**
* Enable verbose logging
*/
@Cordova()
static debugMode(): Promise<any> { return }
static debugMode(): Promise<any> { return; }
/**
* Enable/disable automatic reporting of uncaught exceptions
* @param {boolean} shouldEnable
*/
@Cordova()
static enableUncaughtExceptionReporting(shouldEnable: boolean): Promise<any> { return }
static enableUncaughtExceptionReporting(shouldEnable: boolean): Promise<any> { return; }
}

View File

@ -1,10 +1,10 @@
import {Cordova, Plugin} from "./plugin";
import {Observable} from "rxjs/Observable";
import {CordovaInstance} from "./plugin";
import {Cordova, Plugin} from './plugin';
import {Observable} from 'rxjs/Observable';
import {CordovaInstance} from './plugin';
/**
* Created by Ibrahim on 3/29/2016.
*/
declare var plugin : any;
declare var plugin: any;
/**
* @name Google Maps
*/
@ -15,9 +15,9 @@ declare var plugin : any;
})
export class GoogleMaps {
private _objectInstance : any;
private _objectInstance: any;
constructor (elementId : string) {
constructor (elementId: string) {
this._objectInstance = plugin.google.maps.Map.getMap(document.getElementById(elementId));
}
@ -25,13 +25,13 @@ export class GoogleMaps {
eventObservable: true,
event: 'plugin.google.maps.event.MAP_READY'
})
static onInit () : Observable<GoogleMaps> {return}
static onInit (): Observable<GoogleMaps> {return; }
@CordovaInstance({
sync: true
})
setDebuggable (isDebuggable : boolean) : void {}
setDebuggable (isDebuggable: boolean): void {}
setClickable (isClickable : boolean) : void {}
setClickable (isClickable: boolean): void {}
}

View File

@ -1,4 +1,4 @@
import {Plugin, Cordova} from './plugin'
import {Plugin, Cordova} from './plugin';
/**
* @name Hotspot
@ -20,87 +20,87 @@ import {Plugin, Cordova} from './plugin'
export class Hotspot {
@Cordova()
static isAvailable() : Promise<boolean> {return}
static isAvailable(): Promise<boolean> {return; }
@Cordova()
static toggleWifi() : Promise<any> {return}
static toggleWifi(): Promise<any> {return; }
@Cordova()
static createHotspot(ssid : string, mode : string, password : string) : Promise<any> {return}
static createHotspot(ssid: string, mode: string, password: string): Promise<any> {return; }
@Cordova()
static startHotspot() : Promise<any> {return}
static startHotspot(): Promise<any> {return; }
@Cordova()
static configureHotspot(ssid : string, mode : string, password : string) : Promise<any> {return}
static configureHotspot(ssid: string, mode: string, password: string): Promise<any> {return; }
@Cordova()
static stopHotspot() : Promise<any> {return}
static stopHotspot(): Promise<any> {return; }
@Cordova()
static isHotspotEnabled() : Promise<any> {return}
static isHotspotEnabled(): Promise<any> {return; }
@Cordova()
static getAllHotspotDevices() : Promise<any> {return}
static getAllHotspotDevices(): Promise<any> {return; }
@Cordova()
static connectToHotspot(ssid, password) : Promise<any> {return}
static connectToHotspot(ssid, password): Promise<any> {return; }
@Cordova()
static connectToWifiAuthEncrypt(ssid, password, authentication, encryption) : Promise<any> {return}
static connectToWifiAuthEncrypt(ssid, password, authentication, encryption): Promise<any> {return; }
@Cordova()
static addWifiNetwork(ssid, mode, password) : Promise<any> {return}
static addWifiNetwork(ssid, mode, password): Promise<any> {return; }
@Cordova()
static removeWifiNetwork(ssid) : Promise<any> {return}
static removeWifiNetwork(ssid): Promise<any> {return; }
@Cordova()
static isConnectedToInternet() : Promise<any> {return}
static isConnectedToInternet(): Promise<any> {return; }
@Cordova()
static isConnectedToInternetViaWifi() : Promise<any> {return}
static isConnectedToInternetViaWifi(): Promise<any> {return; }
@Cordova()
static isWifiOn() : Promise<any> {return}
static isWifiOn(): Promise<any> {return; }
@Cordova()
static isWifiSupported() : Promise<any> {return}
static isWifiSupported(): Promise<any> {return; }
@Cordova()
static isWifiDirectSupported() : Promise<any> {return}
static isWifiDirectSupported(): Promise<any> {return; }
@Cordova()
static scanWifi() : Promise<any> {return}
static scanWifi(): Promise<any> {return; }
@Cordova()
static scanWifiByLevel() : Promise<any> {return}
static scanWifiByLevel(): Promise<any> {return; }
@Cordova()
static startPeriodicallyScan(interval, duration) : Promise<any> {return}
static startPeriodicallyScan(interval, duration): Promise<any> {return; }
@Cordova()
static stopPeriodicallyScan() : Promise<any> {return}
static stopPeriodicallyScan(): Promise<any> {return; }
@Cordova()
static getNetConfig() : Promise<any> {return}
static getNetConfig(): Promise<any> {return; }
@Cordova()
static getConnectionInfo() : Promise<any> {return}
static getConnectionInfo(): Promise<any> {return; }
@Cordova()
static pingHost(ip) : Promise<any> {return}
static pingHost(ip): Promise<any> {return; }
@Cordova()
static getMacAddressOfHost(ip) : Promise<any> {return}
static getMacAddressOfHost(ip): Promise<any> {return; }
@Cordova()
static isDnsLive(ip) : Promise<any> {return}
static isDnsLive(ip): Promise<any> {return; }
@Cordova()
static isPortLife(ip) : Promise<any> {return}
static isPortLife(ip): Promise<any> {return; }
@Cordova()
static isRooted() : Promise<any> {return}
static isRooted(): Promise<any> {return; }
}

View File

@ -3,18 +3,18 @@ import {Plugin, Cordova} from './plugin';
export interface ImagePickerOptions {
// max images to be selected, defaults to 15. If this is set to 1, upon
// selection of a single image, the plugin will return it.
maximumImagesCount?: number,
maximumImagesCount?: number;
// max width and height to allow the images to be. Will keep aspect
// ratio no matter what. So if both are 800, the returned image
// will be at most 800 pixels wide and 800 pixels tall. If the width is
// 800 and height 0 the image will be 800 pixels wide if the source
// is at least that wide.
width?: number,
height?: number,
width?: number;
height?: number;
// quality of resized image, defaults to 100
quality?: number
quality?: number;
}
/**
@ -54,5 +54,5 @@ export class ImagePicker {
@Cordova({
callbackOrder: 'reverse'
})
static getPictures(options: ImagePickerOptions): Promise<any> { return }
static getPictures(options: ImagePickerOptions): Promise<any> { return; }
}

View File

@ -81,5 +81,5 @@ export class InAppBrowser {
@Cordova({
sync: true
})
static open(url: string, target?: string, options?: string): InAppBrowserRef { return }
static open(url: string, target?: string, options?: string): InAppBrowserRef { return; }
}

View File

@ -1,5 +1,5 @@
import {Cordova, Plugin} from './plugin'
import {Observable} from "rxjs/Observable";
import {Cordova, Plugin} from './plugin';
import {Observable} from 'rxjs/Observable';
/**
* @name Keyboard
@ -23,11 +23,8 @@ export class Keyboard {
* Hide the keyboard accessory bar with the next, previous and done buttons.
* @param hide {boolean}
*/
//@Cordova({
// sync: true
//})
static hideKeyboardAccessoryBar(hide : boolean) : void {
console.log("hideKeyboardAccessoryBar method has been removed temporarily.")
static hideKeyboardAccessoryBar(hide: boolean): void {
console.log('hideKeyboardAccessoryBar method has been removed temporarily.');
}
/**
@ -35,18 +32,18 @@ export class Keyboard {
*/
@Cordova({
sync: true,
platforms: ['Android','BlackBerry 10','Windows']
platforms: ['Android', 'BlackBerry 10', 'Windows']
})
static show() : void {}
static show(): void {}
/**
* Close the keyboard if open
*/
@Cordova({
sync: true,
platforms: ['iOS','Android','BlackBerry 10','Windows']
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
})
static close() : void {}
static close(): void {}
/**
* Prevents the native UIScrollView from moving when an input is focused.
@ -54,9 +51,9 @@ export class Keyboard {
*/
@Cordova({
sync: true,
platforms: ['iOS','Windows']
platforms: ['iOS', 'Windows']
})
static disableScroll(disable : boolean) : void {}
static disableScroll(disable: boolean): void {}
/**
* Creates an observable that notifies you when the keyboard is shown. Unsubscribe to observable to cancel event watch.
@ -64,9 +61,9 @@ export class Keyboard {
@Cordova({
eventObservable: true,
event: 'native.keyboardshow',
platforms: ['iOS','Android','BlackBerry 10','Windows']
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
})
static onKeyboardShow() : Observable<any> {return}
static onKeyboardShow(): Observable<any> {return; }
/**
* Creates an observable that notifies you when the keyboard is hidden. Unsubscribe to observable to cancel event watch.
@ -74,8 +71,8 @@ export class Keyboard {
@Cordova({
eventObservable: true,
event: 'native.keyboardhide',
platforms: ['iOS','Android','BlackBerry 10','Windows']
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
})
static onKeyboardHide() : Observable<any> {return}
static onKeyboardHide(): Observable<any> {return; }
}

View File

@ -1,48 +1,48 @@
import {Plugin, Cordova} from './plugin';
export interface launchNavigatorOptions {
export interface LaunchNavigatorOptions {
/**
* iOS, Android, Windows
* If true, the plugin will NOT attempt to use the geolocation plugin to determine the current device position when the start location parameter is omitted. Defaults to false.
*/
disableAutoGeolocation? : boolean,
disableAutoGeolocation?: boolean;
/**
* iOS, Android, Windows
* Transportation mode for navigation: "driving", "walking" or "transit". Defaults to "driving" if not specified.
*/
transportMode? : string,
transportMode?: string;
/**
* iOS
* If true, plugin will attempt to launch Google Maps instead of Apple Maps. If Google Maps is not available, it will fall back to Apple Maps.
*/
preferGoogleMaps? : boolean,
preferGoogleMaps?: boolean;
/**
* iOS
* If using Google Maps and the app has a URL scheme, passing this to Google Maps will display a button which returns to the app.
*/
urlScheme? : string,
urlScheme?: string;
/**
* iOS
* If using Google Maps with a URL scheme, this specifies the text of the button in Google Maps which returns to the app. Defaults to "Back" if not specified.
*/
backButtonText? : string,
backButtonText?: string;
/**
* iOS
* If true, debug log output will be generated by the plugin. Defaults to false.
*/
enableDebug? : boolean,
enableDebug?: boolean;
/**
* Android
* Navigation mode in which to open Google Maps app: "maps" or "turn-by-turn". Defaults to "maps" if not specified.
*/
navigationMode? : string,
navigationMode?: string;
}
@ -85,7 +85,7 @@ export class LaunchNavigator {
static navigate(
destination: any,
start: any = null,
options?: launchNavigatorOptions
): Promise<any> { return }
options?: LaunchNavigatorOptions
): Promise<any> { return; }
}

View File

@ -14,7 +14,7 @@ import {Plugin, Cordova} from './plugin';
* LocalNotifications.schedule({
* id: 1,
* text: "Single Notification",
* sound: isAndroid? 'file://sound.mp3' : 'file://beep.caf'
* sound: isAndroid? 'file://sound.mp3': 'file://beep.caf'
* data: { secret: key }
* });
*
@ -23,7 +23,7 @@ import {Plugin, Cordova} from './plugin';
* LocalNotifications.schedule([{
* id: 1,
* text: "Multi Notification 1",
* sound: isAndroid ? 'file://sound.mp3' : 'file://beep.caf',
* sound: isAndroid ? 'file://sound.mp3': 'file://beep.caf',
* data: { secret:key }
* },{
* id: 2,
@ -57,7 +57,7 @@ export class LocalNotifications {
@Cordova({
sync: true
})
static schedule(options? : Notification|Array<Notification>) : void {}
static schedule(options?: Notification|Array<Notification>): void {}
/**
* Updates a previously scheduled notification. Must include the id in the options parameter.
@ -66,14 +66,14 @@ export class LocalNotifications {
@Cordova({
sync: true
})
static update(options? : Notification) : void {}
static update(options?: Notification): void {}
/**
* Clears single or multiple notifications
* @param notificationId A single notification id, or an array of notification ids.
*/
@Cordova()
static clear(notificationId : any) : Promise<any> {return}
static clear(notificationId: any): Promise<any> {return; }
/**
* Clears all notifications
@ -82,14 +82,14 @@ export class LocalNotifications {
successIndex: 0,
errorIndex: 2
})
static clearAll() : Promise<any> {return}
static clearAll(): Promise<any> {return; }
/**
* Cancels single or multiple notifications
* @param notificationId A single notification id, or an array of notification ids.
*/
@Cordova()
static cancel(notificationId : any) : Promise<any> {return}
static cancel(notificationId: any): Promise<any> {return; }
/**
* Cancels all notifications
@ -98,85 +98,85 @@ export class LocalNotifications {
successIndex: 0,
errorIndex: 2
})
static cancelAll() : Promise<any> {return}
static cancelAll(): Promise<any> {return; }
/**
* Checks presence of a notification
* @param notificationId
*/
@Cordova()
static isPresent (notificationId : number) : Promise<boolean> {return}
static isPresent (notificationId: number): Promise<boolean> {return; }
/**
* Checks is a notification is scheduled
* @param notificationId
*/
@Cordova()
static isScheduled (notificationId : number) : Promise<boolean> {return}
static isScheduled (notificationId: number): Promise<boolean> {return; }
/**
* Checks if a notification is triggered
* @param notificationId
*/
@Cordova()
static isTriggered (notificationId : number) : Promise<boolean> {return}
static isTriggered (notificationId: number): Promise<boolean> {return; }
/**
* Get all the notification ids
*/
@Cordova()
static getAllIds () : Promise<Array<number>> {return}
static getAllIds (): Promise<Array<number>> {return; }
/**
* Get the ids of triggered notifications
*/
@Cordova()
static getTriggeredIds () : Promise<Array<number>> {return}
static getTriggeredIds (): Promise<Array<number>> {return; }
/**
* Get the ids of scheduled notifications
*/
@Cordova()
static getScheduledIds () : Promise<Array<number>> {return}
static getScheduledIds (): Promise<Array<number>> {return; }
/**
* Get a notification object
* @param notificationId The id of the notification to get
*/
@Cordova()
static get (notificationId : any) : Promise <Notification> {return}
static get (notificationId: any): Promise <Notification> {return; }
/**
* Get a scheduled notification object
* @param notificationId The id of the notification to get
*/
@Cordova()
static getScheduled (notificationId : any) : Promise <Notification> {return}
static getScheduled (notificationId: any): Promise <Notification> {return; }
/**
* Get a triggered notification object
* @param notificationId The id of the notification to get
*/
@Cordova()
static getTriggered (notificationId : any) : Promise <Notification> {return}
static getTriggered (notificationId: any): Promise <Notification> {return; }
/**
* Get all notification objects
*/
@Cordova()
static getAll() : Promise<Array<Notification>> {return}
static getAll(): Promise<Array<Notification>> {return; }
/**
* Get all scheduled notification objects
*/
@Cordova()
static getAllScheduled() : Promise<Array<Notification>> {return}
static getAllScheduled(): Promise<Array<Notification>> {return; }
/**
* Get all triggered notification objects
*/
@Cordova()
static getAllTriggered() : Promise<Array<Notification>> {return}
static getAllTriggered(): Promise<Array<Notification>> {return; }
/**
@ -187,7 +187,7 @@ export class LocalNotifications {
@Cordova({
sync: true
})
static on(eventName : string, callback : any) : void {}
static on(eventName: string, callback: any): void {}
}
@ -198,64 +198,64 @@ export interface Notification {
* A unique identifier required to clear, cancel, update or retrieve the local notification in the future
* Default: 0
*/
id? : number,
id?: number;
/**
* First row of the notification
* Default: Empty string (iOS) or the app name (Android)
*/
title? : string,
title?: string;
/**
* Second row of the notification
* Default: Empty string
*/
text? : string,
text?: string;
/**
* The interval at which to reschedule the local notification. That can be a value of second, minute, hour, day, week, month or year
* Default: 0 (which means that the system triggers the local notification once)
*/
every? : string,
every?: string;
/**
* The date and time when the system should deliver the local notification. If the specified value is nil or is a date in the past, the local notification is delivered immediately.
* Default: now ~ new Date()
*/
at? : any,
firstAt? : any,
at?: any;
firstAt?: any;
/**
* The number currently set as the badge of the app icon in Springboard (iOS) or at the right-hand side of the local notification (Android)
* Default: 0 (which means don't show a number)
*/
badge? : number,
badge?: number;
/**
* Uri of the file containing the sound to play when an alert is displayed
* Default: res://platform_default
*/
sound? : string,
sound?: string;
/**
* Arbitrary data, objects will be encoded to JSON string
* Default: null
*/
data? : any,
data?: any;
/**
* ANDROID ONLY
* Uri of the icon that is shown in the ticker and notification
* Default: res://icon
*/
icon? : string,
icon?: string;
/**
* ANDROID ONLY
* Uri of the resource (only res://) to use in the notification layouts. Different classes of devices may return different sizes
* Default: res://ic_popup_reminder
*/
smallIcon? : string,
smallIcon?: string;
/**
@ -265,12 +265,12 @@ export interface Notification {
* - They do not have an 'X' close button, and are not affected by the "Clear all" button
* Default: false
*/
ongoing? : boolean,
ongoing?: boolean;
/**
* ANDROID ONLY
* ARGB value that you would like the LED on the device to blink
* Default: FFFFFF
*/
led? : string
led?: string;
}

View File

@ -1,5 +1,5 @@
import {CordovaInstance, Plugin} from './plugin';
declare var Media:any;
declare var Media: any;
/**
* @name MediaPlugin
* @description
@ -44,21 +44,21 @@ declare var Media:any;
export class MediaPlugin {
// Constants
static MEDIA_NONE : number = 0;
static MEDIA_STARTING : number = 1;
static MEDIA_RUNNING : number = 2;
static MEDIA_PAUSED : number = 3;
static MEDIA_STOPPED : number = 4;
static MEDIA_NONE: number = 0;
static MEDIA_STARTING: number = 1;
static MEDIA_RUNNING: number = 2;
static MEDIA_PAUSED: number = 3;
static MEDIA_STOPPED: number = 4;
// Properties
private _objectInstance : any;
private _objectInstance: any;
// Methods
/**
* Open a media file
* @param src {string} A URI containing the audio content.
*/
constructor (src : string) {
constructor (src: string) {
// TODO handle success, error, and status
this._objectInstance = new Media(src);
}
@ -67,13 +67,13 @@ export class MediaPlugin {
* Returns the current amplitude of the current recording.
*/
@CordovaInstance()
getCurrentAmplitude () : Promise<any> {return}
getCurrentAmplitude (): Promise<any> {return; }
/**
* Returns the current position within an audio file. Also updates the Media object's position parameter.
*/
@CordovaInstance()
getCurrentPosition () : Promise<any> {return}
getCurrentPosition (): Promise<any> {return; }
/**
* Returns the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1.
@ -81,7 +81,7 @@ export class MediaPlugin {
@CordovaInstance({
sync: true
})
getDuration () : number {return}
getDuration (): number {return; }
/**
* Starts or resumes playing an audio file.
@ -89,10 +89,10 @@ export class MediaPlugin {
@CordovaInstance({
sync: true
})
play (iosOptions? : {
numberOfLoops? : number,
playAudioWhenScreenIsLocked? : boolean
}) : void {}
play (iosOptions?: {
numberOfLoops?: number,
playAudioWhenScreenIsLocked?: boolean
}): void {}
/**
* Pauses playing an audio file.
@ -100,7 +100,7 @@ export class MediaPlugin {
@CordovaInstance({
sync: true
})
pause () : void {}
pause (): void {}
/**
* Releases the underlying operating system's audio resources. This is particularly important for Android, since there are a finite amount of OpenCore instances for media playback. Applications should call the release function for any Media resource that is no longer needed.
@ -108,7 +108,7 @@ export class MediaPlugin {
@CordovaInstance({
sync: true
})
release () : void {}
release (): void {}
/**
* Sets the current position within an audio file.
@ -117,7 +117,7 @@ export class MediaPlugin {
@CordovaInstance({
sync: true
})
seekTo (milliseconds : number) : void {}
seekTo (milliseconds: number): void {}
/**
* Set the volume for an audio file.
@ -126,7 +126,7 @@ export class MediaPlugin {
@CordovaInstance({
sync: true
})
setVolume (volume : number) : void {}
setVolume (volume: number): void {}
/**
* Starts recording an audio file.
@ -134,7 +134,7 @@ export class MediaPlugin {
@CordovaInstance({
sync: true
})
startRecord () : void {}
startRecord (): void {}
/**
@ -143,7 +143,7 @@ export class MediaPlugin {
@CordovaInstance({
sync: true
})
stopRecord () : void {}
stopRecord (): void {}
/**
@ -152,17 +152,17 @@ export class MediaPlugin {
@CordovaInstance({
sync: true
})
stop () : void {}
stop (): void {}
}
export class MediaError {
static get MEDIA_ERR_ABORTED () {return 1;}
static get MEDIA_ERR_NETWORK () {return 2;}
static get MEDIA_ERR_DECODE () {return 3;}
static get MEDIA_ERR_NONE_SUPPORTED () {return 4;}
code : number;
message : string;
static get MEDIA_ERR_ABORTED () {return 1; }
static get MEDIA_ERR_NETWORK () {return 2; }
static get MEDIA_ERR_DECODE () {return 3; }
static get MEDIA_ERR_NONE_SUPPORTED () {return 4; }
code: number;
message: string;
}

View File

@ -1,7 +1,7 @@
import {Plugin, Cordova, CordovaProperty} from './plugin';
import {Observable} from "rxjs/Observable";
import {Observable} from 'rxjs/Observable';
declare var navigator;
declare var navigator: any;
/**
* @name Network
@ -52,37 +52,37 @@ export class Network {
* Return the network connection type
*/
@CordovaProperty
static get connection() : Connection { return navigator.connection.type; }
static get connection(): Connection { return navigator.connection.type; }
/**
* Watch the network for a disconnect (i.e. network goes offline)
* Get notified when the device goes offline
* @returns {Observable<any>} Returns an observable.
*/
@Cordova({
eventObservable: true,
event: 'offline'
})
static onDisconnect() : Observable<any> { return }
static onDisconnect(): Observable<any> { return; }
/**
* Watch the network for a connection (i.e. network goes online)
* Get notified when the device goes online
* @returns {Observable<any>} Returns an observable.
*/
@Cordova({
eventObservable: true,
event: 'online'
})
static onConnect() : Observable<any> { return; }
static onConnect(): Observable<any> { return; }
}
export class Connection {
static get UNKNOWN() { return "unknown"; }
static get ETHERNET() { return "ethernet"; }
static get WIFI() { return "wifi"; }
static get CELL_2G() { return "2g"; }
static get CELL_3G() { return "3g"; }
static get CELL_4G() { return "4g"; }
static get CELL() { return "cellular"; }
static get NONE() { return "none"; }
static get UNKNOWN() { return 'unknown'; }
static get ETHERNET() { return 'ethernet'; }
static get WIFI() { return 'wifi'; }
static get CELL_2G() { return '2g'; }
static get CELL_3G() { return '3g'; }
static get CELL_4G() { return '4g'; }
static get CELL() { return 'cellular'; }
static get NONE() { return 'none'; }
}

View File

@ -34,7 +34,7 @@ export const isInstalled = function(pluginRef: string): boolean {
export const pluginWarn = function(pluginObj: any, method: string) {
var pluginName = pluginObj.name;
var plugin = pluginObj.plugin;
if(method) {
if (method) {
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
} else {
console.warn('Native: tried accessing the ' + pluginName + ' plugin but it\'s not installed.');
@ -48,47 +48,47 @@ export const pluginWarn = function(pluginObj: any, method: string) {
* @param method
*/
export const cordovaWarn = function(pluginName: string, method: string) {
if(method) {
if (method) {
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
} else {
console.warn('Native: tried accessing the ' + pluginName + ' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
}
};
function setIndex (args:any[], opts:any={}, resolve? : Function, reject?: Function) : any {
// If the plugin method expects myMethod(success, err, options)
if (opts.callbackOrder == 'reverse') {
// Get those arguments in the order [resolve, reject, ...restOfArgs]
args.unshift(reject);
args.unshift(resolve);
} else if(typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
// If we've specified a success/error index
args.splice(opts.successIndex, 0, resolve);
args.splice(opts.errorIndex, 0, reject);
} else {
// Otherwise, let's tack them on to the end of the argument list
// which is 90% of cases
args.push(resolve);
args.push(reject);
}
function setIndex (args: any[], opts: any= {}, resolve?: Function, reject?: Function): any {
// If the plugin method expects myMethod(success, err, options)
if (opts.callbackOrder === 'reverse') {
// Get those arguments in the order [resolve, reject, ...restOfArgs]
args.unshift(reject);
args.unshift(resolve);
} else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
// If we've specified a success/error index
args.splice(opts.successIndex, 0, resolve);
args.splice(opts.errorIndex, 0, reject);
} else {
// Otherwise, let's tack them on to the end of the argument list
// which is 90% of cases
args.push(resolve);
args.push(reject);
}
return args;
return args;
}
function callCordovaPlugin(pluginObj:any, methodName:string, args:any[], opts:any={}, resolve?: Function, reject?: Function) {
function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts: any= {}, resolve?: Function, reject?: Function) {
// Try to figure out where the success/error callbacks need to be bound
// to our promise resolve/reject handlers.
args = setIndex (args, opts, resolve, reject);
args = setIndex (args, opts, resolve, reject);
let pluginInstance = getPlugin(pluginObj.pluginRef);
if(!pluginInstance) {
if (!pluginInstance) {
// Do this check in here in the case that the Web API for this plugin is available (for example, Geolocation).
if(!window.cordova) {
if (!window.cordova) {
cordovaWarn(pluginObj.name, methodName);
return {
error: 'cordova_not_available'
}
};
}
pluginWarn(pluginObj, methodName);
@ -102,12 +102,12 @@ function callCordovaPlugin(pluginObj:any, methodName:string, args:any[], opts:an
}
function getPromise(cb) {
if(window.Promise) {
if (window.Promise) {
// console.log('Native promises available...');
return new Promise((resolve, reject) => {
cb(resolve, reject);
})
} else if(window.angular) {
});
} else if (window.angular) {
let $q = window.angular.injector(['ng']).get('$q');
// console.log('Loaded $q', $q);
return $q((resolve, reject) => {
@ -118,7 +118,7 @@ function getPromise(cb) {
}
}
function wrapPromise(pluginObj:any, methodName:string, args:any[], opts:any={}) {
function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any= {}) {
let pluginResult, rej;
const p = getPromise((resolve, reject) => {
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
@ -134,7 +134,7 @@ function wrapPromise(pluginObj:any, methodName:string, args:any[], opts:any={})
return p;
}
function wrapObservable(pluginObj:any, methodName:string, args:any[], opts:any = {}) {
function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
return new Observable(observer => {
let pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
if (pluginResult && pluginResult.error) {
@ -143,48 +143,48 @@ function wrapObservable(pluginObj:any, methodName:string, args:any[], opts:any =
return () => {
try {
if (opts.clearWithArgs){
if (opts.clearWithArgs) {
return get(window, pluginObj.pluginRef)[opts.clearFunction].apply(pluginObj, args);
}
return get(window, pluginObj.pluginRef)[opts.clearFunction].call(pluginObj, pluginResult);
} catch(e) {
} catch (e) {
console.warn('Unable to clear the previous observable watch for', pluginObj.name, methodName);
console.error(e);
}
}
};
});
}
function callInstance(pluginObj:any, methodName : string, args:any[], opts:any = {}, resolve? : Function, reject? : Function){
args = setIndex(args, opts, resolve, reject);
return pluginObj._objectInstance[methodName].apply(pluginObj._objectInstance, args);
function callInstance(pluginObj: any, methodName: string, args: any[], opts: any = {}, resolve?: Function, reject?: Function) {
args = setIndex(args, opts, resolve, reject);
return pluginObj._objectInstance[methodName].apply(pluginObj._objectInstance, args);
}
function wrapInstance (pluginObj:any, methodName:string, args:any[], opts:any = {}){
function wrapInstance (pluginObj: any, methodName: string, args: any[], opts: any = {}) {
return (...args) => {
if (opts.sync) {
return callInstance(pluginObj, methodName, args, opts);
} else if (opts.observable) {
return new Observable(observer => {
let pluginResult = callInstance(pluginObj, methodName,args, opts, observer.next.bind(observer), observer.error.bind(observer));
let pluginResult = callInstance(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
return () => {
try {
if (opts.clearWithArgs){
if (opts.clearWithArgs) {
return pluginObj._objectInstance[opts.clearFunction].apply(pluginObj._objectInstance, args);
}
return pluginObj._objectInstance[opts.clearFunction].call(pluginObj, pluginResult);
} catch(e) {
} catch (e) {
console.warn('Unable to clear the previous observable watch for', pluginObj.name, methodName);
console.error(e);
}
}
};
});
} else {
return getPromise((resolve, reject) => {
callInstance(pluginObj, methodName, args, opts, resolve, reject);
});
}
}
};
}
/**
@ -192,9 +192,9 @@ function wrapInstance (pluginObj:any, methodName:string, args:any[], opts:any =
* @param event
* @returns {Observable}
*/
function wrapEventObservable (event : string) : Observable<any> {
function wrapEventObservable (event: string): Observable<any> {
return new Observable(observer => {
let callback = (status : any) => observer.next(status);
let callback = (status: any) => observer.next(status);
window.addEventListener(event, callback, false);
return () => window.removeEventListener(event, callback, false);
});
@ -207,10 +207,10 @@ function wrapEventObservable (event : string) : Observable<any> {
* @param opts
* @returns {function(...[any]): (undefined|*|Observable|*|*)}
*/
export const wrap = function(pluginObj:any, methodName:string, opts:any = {}) {
export const wrap = function(pluginObj: any, methodName: string, opts: any = {}) {
return (...args) => {
if (opts.sync)
if (opts.sync)
return callCordovaPlugin(pluginObj, methodName, args, opts);
else if (opts.observable)
@ -221,7 +221,7 @@ export const wrap = function(pluginObj:any, methodName:string, opts:any = {}) {
else
return wrapPromise(pluginObj, methodName, args, opts);
}
};
};
/**
@ -256,7 +256,7 @@ export function Plugin(config) {
};
return cls;
}
};
}
/**
@ -265,7 +265,7 @@ export function Plugin(config) {
* Wrap a stub function in a call to a Cordova plugin, checking if both Cordova
* and the required plugin are installed.
*/
export function Cordova(opts:any = {}) {
export function Cordova(opts: any = {}) {
return (target: Object, methodName: string, descriptor: TypedPropertyDescriptor<any>) => {
let originalMethod = descriptor.value;
@ -273,8 +273,8 @@ export function Cordova(opts:any = {}) {
value: function(...args: any[]) {
return wrap(this, methodName, opts).apply(this, args);
}
}
}
};
};
}
/**
@ -282,14 +282,14 @@ export function Cordova(opts:any = {}) {
*
* Wrap an instance method
*/
export function CordovaInstance(opts:any = {}) {
return (target: Object, methodName: string) => {
return {
value: function(...args: any[]) {
return wrapInstance(this, methodName, opts).apply(this, args);
}
}
}
export function CordovaInstance(opts: any = {}) {
return (target: Object, methodName: string) => {
return {
value: function(...args: any[]) {
return wrapInstance(this, methodName, opts).apply(this, args);
}
};
};
}
/**
@ -302,15 +302,15 @@ export function CordovaProperty(target: Function, key: string, descriptor: Typed
let originalMethod = descriptor.get;
descriptor.get = function(...args: any[]) {
if(!window.cordova) {
if (!window.cordova) {
cordovaWarn(this.name, null);
return {};
}
let pluginInstance = getPlugin(this.pluginRef);
if(!pluginInstance) {
if (!pluginInstance) {
pluginWarn(this, key);
return {};
return { };
}
return originalMethod.apply(this, args);
};

View File

@ -1,41 +1,41 @@
import {Plugin, Cordova} from './plugin';
export type EventResponse = RegistrationEventResponse | NotificationEventResponse | Error
export type EventResponse = RegistrationEventResponse | NotificationEventResponse | Error;
export interface RegistrationEventResponse {
/**
* The registration ID provided by the 3rd party remote push service.
*/
registrationId: string
registrationId: string;
}
export interface NotificationEventResponse {
/**
* The text of the push message sent from the 3rd party service.
*/
message: string
/**
* The optional title of the push message sent from the 3rd party service.
*/
title?: string
/**
* The number of messages to be displayed in the badge iOS or message count in the notification shade in Android.
* For windows, it represents the value in the badge notification which could be a number or a status glyph.
*/
count: string
/**
* The name of the sound file to be played upon receipt of the notification.
*/
sound: string
/**
* The path of the image file to be displayed in the notification.
*/
image: string
/**
* An optional collection of data sent by the 3rd party push service that does not fit in the above properties.
*/
additionalData: NotificationEventAdditionalData
/**
* The text of the push message sent from the 3rd party service.
*/
message: string;
/**
* The optional title of the push message sent from the 3rd party service.
*/
title?: string;
/**
* The number of messages to be displayed in the badge iOS or message count in the notification shade in Android.
* For windows, it represents the value in the badge notification which could be a number or a status glyph.
*/
count: string;
/**
* The name of the sound file to be played upon receipt of the notification.
*/
sound: string;
/**
* The path of the image file to be displayed in the notification.
*/
image: string;
/**
* An optional collection of data sent by the 3rd party push service that does not fit in the above properties.
*/
additionalData: NotificationEventAdditionalData;
}
/**
@ -47,96 +47,96 @@ export interface NotificationEventResponse {
* so that he could specify any custom code without having to use array notation (map['prop']) for all of them.
*/
export interface NotificationEventAdditionalData {
[name: string]: any
[name: string]: any;
/**
* Whether the notification was received while the app was in the foreground
*/
foreground?: boolean
collapse_key?: string
from?: string
notId?: string
/**
* Whether the notification was received while the app was in the foreground
*/
foreground?: boolean;
collapse_key?: string;
from?: string;
notId?: string;
}
export interface PushNotification {
/**
* The event registration will be triggered on each successful registration with the 3rd party push service.
* @param event
* @param callback
*/
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
/**
* 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
/**
*
* @param event Name of the event to listen to. See below(above) for all the event names.
* @param callback is called when the event is triggered.
* @param event
* @param callback
*/
on(event: string, callback: (response: EventResponse) => any): void
/**
* The event registration will be triggered on each successful registration with the 3rd party push service.
* @param event
* @param callback
*/
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;
/**
* 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;
/**
*
* @param event Name of the event to listen to. See below(above) for all the event names.
* @param callback is called when the event is triggered.
* @param event
* @param callback
*/
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
/**
* 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.
* @param callback handle to the function to get removed.
* @param event
* @param callback
*/
off(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;
/**
* 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.
* @param callback handle to the function to get removed.
* @param event
* @param callback
*/
off(event: string, callback: (response: EventResponse) => any): void;
/**
* The unregister method is used when the application no longer wants to receive push notifications.
* Beware that this cleans up all event handlers previously registered,
* so you will need to re-register them if you want them to function again without an application reload.
* @param successHandler
* @param errorHandler
*/
unregister(successHandler: () => any, errorHandler?: () => any): void
/**
* The unregister method is used when the application no longer wants to receive push notifications.
* Beware that this cleans up all event handlers previously registered,
* so you will need to re-register them if you want them to function again without an application reload.
* @param successHandler
* @param errorHandler
*/
unregister(successHandler: () => any, errorHandler?: () => any): void;
/**
* Set the badge count visible when the app is not running
*
* The count is an integer indicating what number should show up in the badge.
* Passing 0 will clear the badge.
* Each notification event contains a data.count value which can be used to set the badge to correct number.
* @param successHandler
* @param errorHandler
* @param count
*/
setApplicationIconBadgeNumber(successHandler: () => any, errorHandler: () => any, count?: number): void
/**
* Get the current badge count visible when the app is not running
* successHandler gets called with an integer which is the current badge count
* @param successHandler
* @param errorHandler
*/
getApplicationIconBadgeNumber(successHandler: (count: number) => any, errorHandler: () => any): void
/**
* Set the badge count visible when the app is not running
*
* The count is an integer indicating what number should show up in the badge.
* Passing 0 will clear the badge.
* Each notification event contains a data.count value which can be used to set the badge to correct number.
* @param successHandler
* @param errorHandler
* @param count
*/
setApplicationIconBadgeNumber(successHandler: () => any, errorHandler: () => any, count?: number): void;
/**
* Get the current badge count visible when the app is not running
* successHandler gets called with an integer which is the current badge count
* @param successHandler
* @param errorHandler
*/
getApplicationIconBadgeNumber(successHandler: (count: number) => any, errorHandler: () => any): void;
/**
* iOS only
* Tells the OS that you are done processing a background push notification.
* successHandler gets called when background push processing is successfully completed.
* @param successHandler
* @param errorHandler
*/
finish(successHandler: () => any, errorHandler: () => any): void
/**
* iOS only
* Tells the OS that you are done processing a background push notification.
* successHandler gets called when background push processing is successfully completed.
* @param successHandler
* @param errorHandler
*/
finish(successHandler: () => any, errorHandler: () => any): void;
}
export interface iOSPushOptions {
export interface IOSPushOptions {
/**
* Maps to the project number in the Google Developer Console. Setting this
* uses GCM for notifications instead of native.
@ -236,14 +236,14 @@ export interface AndroidPushOptions {
}
export interface PushOptions {
ios?: iOSPushOptions;
ios?: IOSPushOptions;
android?: AndroidPushOptions;
windows?: {};
}
declare var PushNotification: {
new(): PushNotification
}
};
/**
* @name Push
@ -292,13 +292,13 @@ export class Push {
@Cordova({
sync: true
})
static init(options: PushOptions): PushNotification { return }
static init(options: PushOptions): PushNotification { return; }
/**
* Check whether the push notification permission has been granted.
* @return {Promise} Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted.
*/
@Cordova()
static hasPermission(): Promise<{ isEnabled: boolean }> { return }
static hasPermission(): Promise<{ isEnabled: boolean }> { return; }
}

View File

@ -19,7 +19,7 @@ export class Screenshot {
successIndex: 1,
errorIndex: 0
})
static save (format?: string, quality?: number, filename?: string) : Promise<any> {return}
static save (format?: string, quality?: number, filename?: string): Promise<any> {return; }
/**
* Takes screenshot and returns the image as an URI
@ -32,5 +32,5 @@ export class Screenshot {
successIndex: 1,
errorIndex: 0
})
static URI (quality?: number) : Promise<any> {return}
static URI (quality?: number): Promise<any> {return; }
}

View File

@ -3,23 +3,23 @@ import {Plugin, Cordova} from './plugin';
/**
* Options for sending an SMS
*/
export interface smsOptions {
export interface SmsOptions {
/**
* Set to true to replace \n by a new line. Default: false
*/
replaceLineBreaks? : boolean,
replaceLineBreaks?: boolean;
android? : smsOptionsAndroid
android?: SmsOptionsAndroid;
}
export interface smsOptionsAndroid {
export interface SmsOptionsAndroid {
/**
* Set to "INTENT" to send SMS with the native android SMS messaging. Leaving it empty will send the SMS without opening any app.
*/
intent? : string
intent?: string;
}
@ -50,16 +50,16 @@ export class SMS {
/**
* Sends sms to a number
* @param number {string|Array<string>} Phone number
* @param phoneNumber {string|Array<string>} Phone number
* @param message {string} Message
* @param options {smsOptions} Options
* @param options {SmsOptions} Options
* @returns {Promise<any>} Resolves promise when the SMS has been sent
*/
@Cordova()
static send(
number: string | string[],
phoneNumber: string | string[],
message: string,
options?: smsOptions
): Promise<any> { return }
options?: SmsOptions
): Promise<any> { return; }
}

View File

@ -16,7 +16,7 @@ import {Plugin, Cordova} from './plugin';
plugin: 'cordova-plugin-x-socialsharing',
pluginRef: 'window.plugins.socialsharing',
repo: 'https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin',
platforms: ['iOS','Android','Windows Phone']
platforms: ['iOS', 'Android', 'Windows Phone']
})
export class SocialSharing {
@ -31,16 +31,16 @@ export class SocialSharing {
@Cordova({
sync: true
})
static share (message? : string, subject? : string, file? : string|Array<string>, url? : string) : void {}
static share (message?: string, subject?: string, file?: string|Array<string>, url?: string): void {}
/**
* Checks if you can share via a specific app.
* @param appName App name or package name. Examples: instagram or com.apple.social.facebook
*/
@Cordova({
platforms: ['iOS','Android']
platforms: ['iOS', 'Android']
})
static canShareVia (appName : string) : Promise<any> {return}
static canShareVia (appName: string): Promise<any> {return; }
/**
* Shares directly to Twitter
@ -50,9 +50,9 @@ export class SocialSharing {
*/
@Cordova({
sync: true,
platforms: ['iOS','Android']
platforms: ['iOS', 'Android']
})
static shareViaTwitter (message : string, image? : string, url? : string) : void {}
static shareViaTwitter (message: string, image?: string, url?: string): void {}
/**
* Shares directly to Facebook
@ -61,9 +61,9 @@ export class SocialSharing {
* @param url {string}
*/
@Cordova({
platforms: ['iOS','Android']
platforms: ['iOS', 'Android']
})
static shareViaFacebook (message : string, image? : string, url? : string) : Promise<any> {return}
static shareViaFacebook (message: string, image?: string, url?: string): Promise<any> {return; }
/**
@ -74,9 +74,9 @@ export class SocialSharing {
* @param pasteMessageHint {string}
*/
@Cordova({
platforms: ['iOS','Android']
platforms: ['iOS', 'Android']
})
static shareViaFacebookWithPasteMessageHint (message : string, image? : string, url? : string, pasteMessageHint?:string) : Promise<any> {return}
static shareViaFacebookWithPasteMessageHint (message: string, image?: string, url?: string, pasteMessageHint?: string): Promise<any> {return; }
/**
* Shares directly to Instagram
@ -84,9 +84,9 @@ export class SocialSharing {
* @param image {string}
*/
@Cordova({
platforms: ['iOS','Android']
platforms: ['iOS', 'Android']
})
static shareViaInstagram (message : string, image : string) : Promise<any> {return}
static shareViaInstagram (message: string, image: string): Promise<any> {return; }
/**
* Shares directly to WhatsApp
@ -95,9 +95,9 @@ export class SocialSharing {
* @param url {string}
*/
@Cordova({
platforms: ['iOS','Android']
platforms: ['iOS', 'Android']
})
static shareViaWhatsApp (message : string, image? : string, url? : string) : Promise<any> {return}
static shareViaWhatsApp (message: string, image?: string, url?: string): Promise<any> {return; }
/**
* Shares directly to a WhatsApp Contact
@ -107,19 +107,19 @@ export class SocialSharing {
* @param url {string} Link to send
*/
@Cordova({
platforms: ['iOS','Android']
platforms: ['iOS', 'Android']
})
static shareViaWhatsAppToReceiver (receiver:string, message : string, image? : string, url? : string) : Promise<any> {return}
static shareViaWhatsAppToReceiver (receiver: string, message: string, image?: string, url?: string): Promise<any> {return; }
/**
* Share via SMS
* @param messge {string} message to send
* @param number {string} Number or multiple numbers seperated by commas
* @param phoneNumber {string} Number or multiple numbers seperated by commas
*/
@Cordova({
platforms: ['iOS','Android']
platforms: ['iOS', 'Android']
})
static shareViaSMS(messge : string, number : string) : Promise<any> {return}
static shareViaSMS(messge: string, phoneNumber: string): Promise<any> {return; }
/**
* Share via Email
@ -131,9 +131,9 @@ export class SocialSharing {
* @param files {string|Array<string>} URL or local path to file(s) to attach
*/
@Cordova({
platforms: ['iOS','Android']
platforms: ['iOS', 'Android']
})
static shareViaEmail(message:string, subject:string, to:Array<string>, cc:Array<string>, bcc:Array<string>, files:string|Array<string>) : Promise<any> {return}
static shareViaEmail(message: string, subject: string, to: Array<string>, cc: Array<string>, bcc: Array<string>, files: string|Array<string>): Promise<any> {return; }
}

View File

@ -18,7 +18,7 @@ import {Plugin, Cordova} from './plugin';
plugin: 'cordova-plugin-spinner-dialog',
pluginRef: 'window.plugins.spinnerDialog',
repo: 'https://github.com/Paldom/SpinnerDialog',
platforms: ['Android','iOS','Windows Phone 8']
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
export class SpinnerDialog {
@ -33,7 +33,7 @@ export class SpinnerDialog {
@Cordova({
sync: true
})
static show(title? : string, message? : string, cancelCallback? : any, iOSOptions? : SpinnerDialogIOSOptions) : void {}
static show(title?: string, message?: string, cancelCallback?: any, iOSOptions?: SpinnerDialogIOSOptions): void {}
/**
* Hides the spinner dialog if visible
@ -41,13 +41,13 @@ export class SpinnerDialog {
@Cordova({
sync: true
})
static hide() : void {}
static hide(): void {}
}
export interface SpinnerDialogIOSOptions {
overlayOpacity? : number,
textColorRed? : number,
textColorGreen? : number,
textColorBlue? : number
overlayOpacity?: number;
textColorRed?: number;
textColorGreen?: number;
textColorBlue?: number;
}

View File

@ -1,4 +1,4 @@
import {Plugin, Cordova} from './plugin'
import {Plugin, Cordova} from './plugin';
/**
* @name Splashscreen
@ -27,7 +27,7 @@ export class Splashscreen {
@Cordova({
sync: true
})
static show() : void {}
static show(): void {}
/**
* Hides the splashscreen
@ -35,6 +35,6 @@ export class Splashscreen {
@Cordova({
sync: true
})
static hide() : void {}
static hide(): void {}
}

View File

@ -10,12 +10,12 @@ declare var sqlitePlugin;
})
export class SQLite {
private _objectInstance : any;
get databaseFeatures() : any {
private _objectInstance: any;
get databaseFeatures(): any {
return this._objectInstance.databaseFeatures;
}
constructor (config : any) {
constructor (config: any) {
new Promise((resolve, reject) => {
sqlitePlugin.openDatabase(config, resolve, reject);
}).then(
@ -27,81 +27,81 @@ export class SQLite {
@CordovaInstance({
sync: true
})
addTransaction (transaction : any) : void {}
addTransaction (transaction: any): void {}
@CordovaInstance()
transaction (fn : any) : Promise<any> {return}
transaction (fn: any): Promise<any> {return; }
@CordovaInstance()
readTransaction (fn : any) : Promise<any> {return}
readTransaction (fn: any): Promise<any> {return; }
@CordovaInstance({
sync: true
})
startNextTransaction () : void {}
startNextTransaction (): void {}
@CordovaInstance()
close () : Promise<any> {return}
close (): Promise<any> {return; }
@CordovaInstance({
sync: true
})
start () : void {}
start (): void {}
@CordovaInstance()
executeSql (statement : string, params : any) : Promise<any> {return}
executeSql (statement: string, params: any): Promise<any> {return; }
@CordovaInstance()
addSatement (sql, values) : Promise<any> {return}
addSatement (sql, values): Promise<any> {return; }
@CordovaInstance()
sqlBatch (sqlStatements : any) : Promise<any> {return}
sqlBatch (sqlStatements: any): Promise<any> {return; }
@CordovaInstance({
sync: true
})
abortallPendingTransactions () : void {}
abortallPendingTransactions (): void {}
@CordovaInstance({
sync: true
})
handleStatementSuccess (handler, response) : void {}
handleStatementSuccess (handler, response): void {}
@CordovaInstance({
sync: true
})
handleStatementFailure (handler, response) : void {}
handleStatementFailure (handler, response): void {}
@CordovaInstance({
sync: true
})
run () : void {}
run (): void {}
@CordovaInstance({
sync: true
})
abort (txFailure) : void {}
abort (txFailure): void {}
@CordovaInstance({
sync: true
})
finish () : void {}
finish (): void {}
@CordovaInstance({
sync: true
})
abortFromQ (sqlerror) : void {}
abortFromQ (sqlerror): void {}
@Cordova()
static echoTest () : Promise<any> {return}
static echoTest (): Promise<any> {return; }
@Cordova()
static deleteDatabase (first) : Promise<any> {return}
static deleteDatabase (first): Promise<any> {return; }
}

View File

@ -36,7 +36,7 @@ export class StatusBar {
@Cordova({
sync: true
})
static overlaysWebView(doesOverlay: boolean){};
static overlaysWebView(doesOverlay: boolean) {};
/**
* Use the default statusbar (dark text, for light backgrounds).
@ -44,7 +44,7 @@ export class StatusBar {
@Cordova({
sync: true
})
static styleDefault(){};
static styleDefault() {};
/**
* Use the lightContent statusbar (light text, for dark backgrounds).
@ -52,7 +52,7 @@ export class StatusBar {
@Cordova({
sync: true
})
static styleLightContent(){};
static styleLightContent() {};
/**
* Use the blackTranslucent statusbar (light text, for dark backgrounds).
@ -60,7 +60,7 @@ export class StatusBar {
@Cordova({
sync: true
})
static styleBlackTranslucent(){};
static styleBlackTranslucent() {};
/**
* Use the blackOpaque statusbar (light text, for dark backgrounds).
@ -68,7 +68,7 @@ export class StatusBar {
@Cordova({
sync: true
})
static styleBlackOpaque(){};
static styleBlackOpaque() {};
/**
* Set the status bar to a specific named color. Valid options:
@ -81,7 +81,7 @@ export class StatusBar {
@Cordova({
sync: true
})
static backgroundColorByName(colorName: string){};
static backgroundColorByName(colorName: string) {};
/**
* Set the status bar to a specific hex color (CSS shorthand supported!).
@ -93,7 +93,7 @@ export class StatusBar {
@Cordova({
sync: true
})
static backgroundColorByHexString(hexString: string){};
static backgroundColorByHexString(hexString: string) {};
/**
* Hide the StatusBar
@ -101,7 +101,7 @@ export class StatusBar {
@Cordova({
sync: true
})
static hide(){};
static hide() {};
/**
* Show the StatusBar
@ -109,7 +109,7 @@ export class StatusBar {
@Cordova({
sync: true
})
static show(){};
static show() {};
/**
* Whether the StatusBar is currently visible or not.

View File

@ -25,13 +25,13 @@ export interface ToastOptions {
/**
* Styling
*/
styling? : {
opacity? : number;
backgroundColor? : string;
textColor? : string;
cornerRadius? : number;
horizontalPadding? : number;
verticalPadding? : number;
styling?: {
opacity?: number;
backgroundColor?: string;
textColor?: string;
cornerRadius?: number;
horizontalPadding?: number;
verticalPadding?: number;
};
}
/**
@ -77,14 +77,14 @@ export class Toast {
message: string,
duration: string,
position: string
): Observable<any> { return }
): Observable<any> { return; }
/**
* Manually hide any currently visible toast.
* @return {Promise} Returns a Promise that resolves on success.
*/
@Cordova()
static hide(): Promise<any>{ return }
static hide(): Promise<any> { return; }
/**
* Show a native toast with the given options.
@ -101,7 +101,7 @@ export class Toast {
observable: true,
clearFunction: 'hide'
})
static showWithOptions(options: ToastOptions): Observable<any> { return }
static showWithOptions(options: ToastOptions): Observable<any> { return; }
/**
* Shorthand for `show(message, 'short', 'top')`.
@ -111,7 +111,7 @@ export class Toast {
observable: true,
clearFunction: 'hide'
})
static showShortTop(message: string): Observable<any> { return }
static showShortTop(message: string): Observable<any> { return; }
/**
* Shorthand for `show(message, 'short', 'center')`.
@ -121,7 +121,7 @@ export class Toast {
observable: true,
clearFunction: 'hide'
})
static showShortCenter(message: string): Observable<any> { return }
static showShortCenter(message: string): Observable<any> { return; }
/**
@ -132,7 +132,7 @@ export class Toast {
observable: true,
clearFunction: 'hide'
})
static showShortBottom(message: string): Observable<any> { return }
static showShortBottom(message: string): Observable<any> { return; }
/**
@ -143,7 +143,7 @@ export class Toast {
observable: true,
clearFunction: 'hide'
})
static showLongTop(message: string): Observable<any> { return }
static showLongTop(message: string): Observable<any> { return; }
/**
@ -154,7 +154,7 @@ export class Toast {
observable: true,
clearFunction: 'hide'
})
static showLongCenter(message: string): Observable<any> { return }
static showLongCenter(message: string): Observable<any> { return; }
/**
@ -165,6 +165,6 @@ export class Toast {
observable: true,
clearFunction: 'hide'
})
static showLongBottom(message: string): Observable<any> { return }
static showLongBottom(message: string): Observable<any> { return; }
}

View File

@ -40,7 +40,7 @@ export class TouchID {
* @return {Promise} Returns a Promise that resolves if yes, rejects if no.
*/
@Cordova()
isAvailable(): Promise<any>{ return }
isAvailable(): Promise<any> { return; }
/**
* Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, brings up standard system passcode screen.
@ -49,7 +49,7 @@ export class TouchID {
* @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
*/
@Cordova()
static verifyFingerprint(message: string): Promise<any>{ return }
static verifyFingerprint(message: string): Promise<any> { return; }
/**
* Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above).
@ -58,7 +58,7 @@ export class TouchID {
* @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
*/
@Cordova()
static verifyFingerprintWithCustomPasswordFallback(message: string): Promise<any> { return }
static verifyFingerprintWithCustomPasswordFallback(message: string): Promise<any> { return; }
/**
* Show TouchID dialog with custom 'Enter Password' message and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above).
@ -68,5 +68,5 @@ export class TouchID {
* @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
*/
@Cordova()
static verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel(message: string, enterPasswordLabel: string): Promise<any> { return }
static verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel(message: string, enterPasswordLabel: string): Promise<any> { return; }
}

View File

@ -1,4 +1,4 @@
import {Plugin, Cordova} from './plugin'
import {Plugin, Cordova} from './plugin';
/**
* @name Vibration
* @description Vibrates the device
@ -36,6 +36,6 @@ export class Vibration {
@Cordova({
sync: true
})
static vibrate(time : any) {}
static vibrate(time: any) {}
}

View File

@ -18,21 +18,21 @@ export class WebIntent {
}
@Cordova()
static startActivity (options : {action:any,url:string}) : Promise<any> {return}
static startActivity (options: {action: any, url: string}): Promise<any> {return; }
@Cordova()
static hasExtra (extra : any) : Promise<any> {return}
static hasExtra (extra: any): Promise<any> {return; }
@Cordova()
static getExtra (extra : any) : Promise<any> {return}
static getExtra (extra: any): Promise<any> {return; }
@Cordova()
static getUri () : Promise<string> {return};
static getUri (): Promise<string> {return; };
@Cordova()
static onNewIntent() : Promise<string> {return};
static onNewIntent(): Promise<string> {return; };
@Cordova()
static sendBroadcast(options : {action:string, extras?:{option:boolean}}) : Promise<any> {return}
static sendBroadcast(options: {action: string, extras?: {option: boolean}}): Promise<any> {return; }
}

View File

@ -1,6 +1,6 @@
export function get(obj, path) {
for(var i = 0, path = path.split('.'), len = path.length; i < len; i++) {
if(!obj) { return null; }
for (var i = 0, path = path.split('.'), len = path.length; i < len; i++) {
if (!obj) { return null; }
obj = obj[path[i]];
}
return obj;

62
tslint.json Normal file
View File

@ -0,0 +1,62 @@
{
"rulesDirectory": "node_modules/tslint-eslint-rules/dist/rules",
"rules": {
"class-name": true,
"comment-format": [
true,
"check-space"
],
"indent": [
true,
"spaces"
],
"no-duplicate-variable": true,
"no-eval": true,
"no-internal-module": true,
"no-trailing-whitespace": true,
"no-var-keyword": false,
"one-line": [
true,
"check-open-brace",
"check-whitespace"
],
"quotemark": [
true,
"single"
],
"semicolon": [
true,
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"variable-name": [
true,
"ban-keywords"
],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
],
"no-inner-declarations": [
true,
"functions"
]
}
}