mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 00:23:00 +08:00
refactor(): no implicit any
This commit is contained in:
parent
fec19b734c
commit
a28de660bc
@ -53,14 +53,17 @@ const PLUGINS = fs.readdirSync(PLUGINS_PATH);
|
||||
// Build specific list of plugins to build from arguments, if any
|
||||
let pluginsToBuild = process.argv.slice(2);
|
||||
let ignoreErrors = false;
|
||||
let errors = [];
|
||||
|
||||
const index = pluginsToBuild.indexOf('ignore-errors');
|
||||
if (index > -1) {
|
||||
ignoreErrors = true;
|
||||
pluginsToBuild.splice(index, 1);
|
||||
console.log('Build will continue even if errors were thrown. Errors will be printed when build finishes.');
|
||||
}
|
||||
|
||||
if (!pluginsToBuild.length) {
|
||||
pluginsToBuild = PLUGINS;
|
||||
} else {
|
||||
const index = pluginsToBuild.indexOf('--ignore-errors');
|
||||
if (index > -1) {
|
||||
ignoreErrors = true;
|
||||
pluginsToBuild.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Create a queue to process tasks
|
||||
@ -109,12 +112,14 @@ const addPluginToQueue = pluginName => {
|
||||
exec(`${ROOT}/node_modules/.bin/ngc -p ${tsConfigPath}`, (err, stdout, stderr) => {
|
||||
|
||||
if (err) {
|
||||
console.log(err);
|
||||
|
||||
if (!ignoreErrors) {
|
||||
// oops! something went wrong.
|
||||
console.log(err);
|
||||
callback(`\n\nBuilding ${pluginName} failed.`);
|
||||
return;
|
||||
} else {
|
||||
errors.push(err);
|
||||
}
|
||||
|
||||
}
|
||||
@ -137,6 +142,9 @@ QUEUE.start((err) => {
|
||||
|
||||
if (err) {
|
||||
console.log('Error building plugins. ', err);
|
||||
} else if (errors.length) {
|
||||
errors.forEach(e => console.log(e.message) && console.log('\n'));
|
||||
console.log('Build complete with errors');
|
||||
} else {
|
||||
console.log('Done processing plugins!');
|
||||
}
|
||||
|
@ -13,7 +13,8 @@
|
||||
"skipLibCheck": true,
|
||||
"lib": ["es2015", "dom"],
|
||||
"sourceMap": true,
|
||||
"inlineSources": true
|
||||
"inlineSources": true,
|
||||
"noImplicitAny": true
|
||||
},
|
||||
"files": [
|
||||
"../../src/@ionic-native/core/index.ts"
|
||||
|
@ -16,7 +16,8 @@
|
||||
"skipLibCheck": true,
|
||||
"lib": ["es2015", "dom"],
|
||||
"sourceMap": true,
|
||||
"inlineSources": true
|
||||
"inlineSources": true,
|
||||
"noImplicitAny": true
|
||||
},
|
||||
"files": []
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
declare var window;
|
||||
|
||||
export function checkReady() {
|
||||
const DEVICE_READY_TIMEOUT = 5000;
|
||||
|
||||
@ -16,7 +14,7 @@ export function checkReady() {
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
if (!didFireReady && window.cordova) {
|
||||
if (!didFireReady && !!window.cordova) {
|
||||
console.warn(`Ionic 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);
|
||||
|
@ -32,6 +32,8 @@ export interface PluginConfig {
|
||||
* Supported platforms
|
||||
*/
|
||||
platforms?: string[];
|
||||
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface CordovaOptions {
|
||||
@ -182,12 +184,12 @@ export function CordovaCheck(opts: CordovaCheckOptions = {}) {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export function Plugin(config: PluginConfig) {
|
||||
return function(cls) {
|
||||
export function Plugin(config: PluginConfig): ClassDecorator {
|
||||
return function(cls: any) {
|
||||
|
||||
// Add these fields to the class
|
||||
for (let k in config) {
|
||||
cls[k] = config[k];
|
||||
for (let prop in config) {
|
||||
cls[prop] = config[prop];
|
||||
}
|
||||
|
||||
cls['installed'] = function(printWarning?: boolean) {
|
||||
|
@ -7,8 +7,8 @@ import 'rxjs/add/observable/fromEvent';
|
||||
|
||||
checkReady();
|
||||
|
||||
declare var window;
|
||||
declare var Promise;
|
||||
// declare const window;
|
||||
// declare var Promise;
|
||||
|
||||
|
||||
/**
|
||||
@ -16,8 +16,8 @@ declare var Promise;
|
||||
* @return {boolean | { error: string } }
|
||||
* @private
|
||||
*/
|
||||
export function checkAvailability(pluginRef: string, methodName?: string, pluginName?: string);
|
||||
export function checkAvailability(pluginObj: any, methodName?: string, pluginName?: string);
|
||||
export function checkAvailability(pluginRef: string, methodName?: string, pluginName?: string): boolean | { error: string };
|
||||
export function checkAvailability(pluginObj: any, methodName?: string, pluginName?: string): boolean | { error: string };
|
||||
export function checkAvailability(plugin: any, methodName?: string, pluginName?: string): boolean | { error: string } {
|
||||
|
||||
let pluginRef, pluginInstance, pluginPackage;
|
||||
@ -69,7 +69,7 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func
|
||||
args.unshift(reject);
|
||||
args.unshift(resolve);
|
||||
} else if (opts.callbackStyle === 'node') {
|
||||
args.push((err, result) => {
|
||||
args.push((err: any, result: any) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
@ -135,8 +135,8 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts
|
||||
}
|
||||
|
||||
function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
|
||||
let pluginResult, rej;
|
||||
const p = getPromise((resolve, reject) => {
|
||||
let pluginResult: any, rej: Function;
|
||||
const p = getPromise((resolve: Function, reject: Function) => {
|
||||
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
|
||||
rej = reject;
|
||||
});
|
||||
@ -145,13 +145,13 @@ function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any
|
||||
// to error
|
||||
if (pluginResult && pluginResult.error) {
|
||||
p.catch(() => { });
|
||||
rej(pluginResult.error);
|
||||
typeof rej === 'function' && rej(pluginResult.error);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
|
||||
return getPromise((resolve, reject) => {
|
||||
return getPromise((resolve: Function, reject: Function) => {
|
||||
const pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts);
|
||||
if (pluginResult) {
|
||||
if (pluginResult.error) {
|
||||
@ -239,7 +239,7 @@ export function overrideFunction(pluginObj: any, methodName: string, args: any[]
|
||||
* @private
|
||||
*/
|
||||
export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOptions = {}) {
|
||||
return (...args) => {
|
||||
return (...args: any[]) => {
|
||||
if (opts.sync) {
|
||||
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
|
||||
return callCordovaPlugin(pluginObj, methodName, args, opts);
|
||||
@ -259,7 +259,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOp
|
||||
* @private
|
||||
*/
|
||||
export function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) {
|
||||
return (...args) => {
|
||||
return (...args: any[]) => {
|
||||
if (opts.sync) {
|
||||
|
||||
return callInstance(pluginObj, methodName, args, opts);
|
||||
@ -289,7 +289,7 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
|
||||
|
||||
} else if (opts.otherPromise) {
|
||||
|
||||
return getPromise((resolve, reject) => {
|
||||
return getPromise((resolve: Function, reject: Function) => {
|
||||
let result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
|
||||
if (result && !result.error) {
|
||||
result.then(resolve, reject);
|
||||
@ -298,14 +298,14 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
|
||||
|
||||
} else {
|
||||
|
||||
let pluginResult, rej;
|
||||
const p = getPromise((resolve, reject) => {
|
||||
let pluginResult: any, rej: Function;
|
||||
const p = getPromise((resolve: Function, reject: Function) => {
|
||||
pluginResult = callInstance(pluginObj, methodName, args, opts, resolve, reject);
|
||||
rej = reject;
|
||||
});
|
||||
if (pluginResult && pluginResult.error) {
|
||||
p.catch(() => { });
|
||||
rej(pluginResult.error);
|
||||
typeof rej === 'function' && rej(pluginResult.error);
|
||||
}
|
||||
return p;
|
||||
|
||||
|
@ -1,27 +1,28 @@
|
||||
declare var window: any;
|
||||
declare const window: any;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export function get(obj, path) {
|
||||
path = path.split('.');
|
||||
for (let i = 0; i < path.length; i++) {
|
||||
export const get = (element: Element | Window, path: string): any => {
|
||||
const paths: string[] = path.split('.');
|
||||
let obj: any = element;
|
||||
for (let i: number = 0; i < paths.length; i++) {
|
||||
if (!obj) { return null; }
|
||||
obj = obj[path[i]];
|
||||
obj = obj[paths[i]];
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export function getPromise(cb) {
|
||||
export const getPromise = (callback: Function): Promise<any> => {
|
||||
|
||||
const tryNativePromise = () => {
|
||||
if (window.Promise) {
|
||||
return new Promise((resolve, reject) => {
|
||||
cb(resolve, reject);
|
||||
callback(resolve, reject);
|
||||
});
|
||||
} else {
|
||||
console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 2 or on a recent browser.');
|
||||
@ -29,21 +30,21 @@ export function getPromise(cb) {
|
||||
};
|
||||
|
||||
return tryNativePromise();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param pluginRef
|
||||
* @returns {null|*}
|
||||
*/
|
||||
export function getPlugin(pluginRef: string): any {
|
||||
export const getPlugin = (pluginRef: string): any => {
|
||||
return get(window, pluginRef);
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export const pluginWarn = function(pluginName: string, plugin?: string, method?: string) {
|
||||
export const pluginWarn = (pluginName: string, plugin?: string, method?: string): void => {
|
||||
if (method) {
|
||||
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
|
||||
} else {
|
||||
@ -59,7 +60,7 @@ export const pluginWarn = function(pluginName: string, plugin?: string, method?:
|
||||
* @param pluginName
|
||||
* @param method
|
||||
*/
|
||||
export const cordovaWarn = function(pluginName: string, method?: string) {
|
||||
export const cordovaWarn = (pluginName: string, method?: string): void => {
|
||||
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 {
|
||||
|
@ -1,9 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
declare var window;
|
||||
|
||||
export interface AppRatePreferences {
|
||||
|
||||
/**
|
||||
|
@ -1,9 +1,6 @@
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
declare var window;
|
||||
|
||||
|
||||
export interface BackgroundFetchConfig {
|
||||
|
||||
/**
|
||||
|
@ -2,8 +2,6 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var window;
|
||||
|
||||
export interface BackgroundGeolocationResponse {
|
||||
|
||||
/**
|
||||
|
@ -109,8 +109,8 @@ interface LocalPackage_Static {
|
||||
}
|
||||
/* tslint:enable */
|
||||
|
||||
declare var RemotePackage: RemotePackage_Static;
|
||||
declare var LocalPackage: LocalPackage_Static;
|
||||
declare const RemotePackage: RemotePackage_Static;
|
||||
declare const LocalPackage: LocalPackage_Static;
|
||||
|
||||
/**
|
||||
* Defines the JSON format of the current package information file.
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaInstance, InstanceProperty, Plugin, getPromise, InstanceCheck, checkAvailability, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare var window: any,
|
||||
declare const window: any,
|
||||
navigator: any;
|
||||
|
||||
export type ContactFieldType = '*' | 'addresses' | 'birthday' | 'categories' | 'country' | 'department' | 'displayName' | 'emails' | 'familyName' | 'formatted' | 'givenName' | 'honorificPrefix' | 'honorificSuffix' | 'id' | 'ims' | 'locality' | 'middleName' | 'name' | 'nickname' | 'note' | 'organizations' | 'phoneNumbers' | 'photos' | 'postalCode' | 'region' | 'streetAddress' | 'title' | 'urls';
|
||||
@ -49,6 +49,7 @@ export interface IContactProperties {
|
||||
|
||||
/** An array of web pages associated with the contact. */
|
||||
urls?: IContactField[];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -71,6 +72,8 @@ export class Contact implements IContactProperties {
|
||||
@InstanceProperty categories: IContactField[];
|
||||
@InstanceProperty urls: IContactField[];
|
||||
|
||||
[key: string]: any;
|
||||
|
||||
constructor() {
|
||||
if (checkAvailability('navigator.contacts', 'create', 'Contacts') === true) {
|
||||
this._objectInstance = navigator.contacts.create();
|
||||
@ -92,8 +95,8 @@ export class Contact implements IContactProperties {
|
||||
|
||||
@InstanceCheck()
|
||||
save(): Promise<any> {
|
||||
return getPromise((resolve, reject) => {
|
||||
this._objectInstance.save((contact) => {
|
||||
return getPromise((resolve: Function, reject: Function) => {
|
||||
this._objectInstance.save((contact: any) => {
|
||||
this._objectInstance = contact;
|
||||
resolve(this);
|
||||
}, reject);
|
||||
@ -114,7 +117,7 @@ export interface IContactError {
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
export declare var ContactError: {
|
||||
export declare const ContactError: {
|
||||
new (code: number): IContactError;
|
||||
UNKNOWN_ERROR: number;
|
||||
INVALID_ARGUMENT_ERROR: number;
|
||||
@ -312,8 +315,8 @@ export class Contacts extends IonicNativePlugin {
|
||||
*/
|
||||
@CordovaCheck()
|
||||
find(fields: ContactFieldType[], options?: IContactFindOptions): Promise<Contact[]> {
|
||||
return getPromise((resolve, reject) => {
|
||||
navigator.contacts.find(fields, (contacts) => {
|
||||
return getPromise((resolve: Function, reject: Function) => {
|
||||
navigator.contacts.find(fields, (contacts: any[]) => {
|
||||
resolve(contacts.map(processContact));
|
||||
}, reject, options);
|
||||
});
|
||||
@ -325,8 +328,8 @@ export class Contacts extends IonicNativePlugin {
|
||||
*/
|
||||
@CordovaCheck()
|
||||
pickContact(): Promise<Contact> {
|
||||
return getPromise((resolve, reject) => {
|
||||
navigator.contacts.pickContact((contact) => resolve(processContact(contact)), reject);
|
||||
return getPromise((resolve: Function, reject: Function) => {
|
||||
navigator.contacts.pickContact((contact: any) => resolve(processContact(contact)), reject);
|
||||
});
|
||||
}
|
||||
|
||||
@ -335,7 +338,7 @@ export class Contacts extends IonicNativePlugin {
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
function processContact(contact) {
|
||||
function processContact(contact: any) {
|
||||
let newContact = new Contact();
|
||||
for (let prop in contact) {
|
||||
if (typeof contact[prop] === 'function') continue;
|
||||
|
@ -98,7 +98,7 @@ export class Deeplinks extends IonicNativePlugin {
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
route(paths): Observable<DeeplinkMatch> { return; }
|
||||
route(paths: any): Observable<DeeplinkMatch> { return; }
|
||||
|
||||
/**
|
||||
*
|
||||
@ -121,6 +121,6 @@ export class Deeplinks extends IonicNativePlugin {
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
routeWithNavController(navController, paths): Observable<DeeplinkMatch> { return; }
|
||||
routeWithNavController(navController: any, paths: any): Observable<DeeplinkMatch> { return; }
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare var window: any;
|
||||
declare const window: any;
|
||||
|
||||
/**
|
||||
* @name Device
|
||||
|
@ -75,7 +75,7 @@ export class Dialogs extends IonicNativePlugin {
|
||||
successIndex: 1,
|
||||
errorIndex: 4
|
||||
})
|
||||
confirm(message, title?: string, buttonLabels?: string[]): Promise<number> { return; }
|
||||
confirm(message: string, title?: string, buttonLabels?: string[]): Promise<number> { return; }
|
||||
|
||||
/**
|
||||
* Displays a native dialog box that is more customizable than the browser's prompt function.
|
||||
|
@ -1,7 +1,11 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare var cordova: any;
|
||||
interface Cordova {
|
||||
plugins: CordovaPlugins & { email: any };
|
||||
}
|
||||
|
||||
declare const cordova: Cordova;
|
||||
|
||||
export interface EmailComposerOptions {
|
||||
|
||||
@ -88,7 +92,7 @@ export class EmailComposer extends IonicNativePlugin {
|
||||
isAvailable(app?: string): Promise<any> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
if (app) {
|
||||
cordova.plugins.email.isAvailable(app, (isAvailable) => {
|
||||
cordova.plugins.email.isAvailable(app, (isAvailable: boolean) => {
|
||||
if (isAvailable) {
|
||||
resolve();
|
||||
} else {
|
||||
@ -96,7 +100,7 @@ export class EmailComposer extends IonicNativePlugin {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
cordova.plugins.email.isAvailable((isAvailable) => {
|
||||
cordova.plugins.email.isAvailable((isAvailable: boolean) => {
|
||||
if (isAvailable) {
|
||||
resolve();
|
||||
} else {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare var window: any;
|
||||
declare const window: any;
|
||||
|
||||
/**
|
||||
* @name File Path
|
||||
|
@ -517,6 +517,11 @@ export declare class FileReader {
|
||||
readAsBinaryString(fe: IFile): void;
|
||||
readAsArrayBuffer(fe: IFile): void;
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
[key: string]: any;
|
||||
|
||||
}
|
||||
|
||||
interface Window extends LocalFileSystem {}
|
||||
@ -630,7 +635,7 @@ export class File extends IonicNativePlugin {
|
||||
@CordovaProperty
|
||||
sharedDirectory: string;
|
||||
|
||||
cordovaFileError: {} = {
|
||||
cordovaFileError: any = {
|
||||
1: 'NOT_FOUND_ERR',
|
||||
2: 'SECURITY_ERR',
|
||||
3: 'ABORT_ERR',
|
||||
|
@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, CordovaFunctionOverride, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var window: any;
|
||||
declare const window: any;
|
||||
|
||||
/**
|
||||
* @name Geofence
|
||||
|
@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var navigator: any;
|
||||
declare const navigator: any;
|
||||
|
||||
export interface Coordinates {
|
||||
|
||||
@ -174,7 +174,7 @@ export class Geolocation extends IonicNativePlugin {
|
||||
* Observable changes.
|
||||
*
|
||||
* ```typescript
|
||||
* var subscription = this.geolocation.watchPosition()
|
||||
* const subscription = this.geolocation.watchPosition()
|
||||
* .filter((p) => p.coords !== undefined) //Filter Out Errors
|
||||
* .subscribe(position => {
|
||||
* console.log(position.coords.longitude + ' ' + position.coords.latitude);
|
||||
|
@ -1,8 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare var window;
|
||||
|
||||
/**
|
||||
* @name Google Analytics
|
||||
* @description
|
||||
|
@ -3,7 +3,7 @@ import { Cordova, CordovaInstance, CordovaCheck, Plugin, InstanceProperty, Insta
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/observable/fromEvent';
|
||||
|
||||
declare var plugin: any;
|
||||
declare const plugin: any;
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
@ -1473,7 +1473,7 @@ export class GroundOverlay {
|
||||
return Promise.reject({ error: 'plugin_not_installed' });
|
||||
}
|
||||
return new Promise<any>(
|
||||
resolve => this._objectInstance.addListenerOnce(eventName, resolve)
|
||||
(resolve: Function) => this._objectInstance.addListenerOnce(eventName, resolve)
|
||||
);
|
||||
}
|
||||
|
||||
@ -1766,7 +1766,7 @@ export class Geocoder {
|
||||
*/
|
||||
@CordovaCheck()
|
||||
geocode(request: GeocoderRequest): Promise<GeocoderResult[] | any> {
|
||||
return new Promise<GeocoderResult[]>(resolve => {
|
||||
return new Promise<GeocoderResult[]>((resolve: Function) => {
|
||||
plugin.google.maps.Geocoder.geocode(request, resolve);
|
||||
});
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
declare var navigator: any;
|
||||
declare const navigator: any;
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
|
@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var cordova: any;
|
||||
declare const cordova: any;
|
||||
|
||||
export interface Beacon {
|
||||
/**
|
||||
|
@ -3,7 +3,7 @@ import { Plugin, CordovaInstance, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/observable/fromEvent';
|
||||
|
||||
declare var cordova: any;
|
||||
declare const cordova: Cordova & { InAppBrowser: any; };
|
||||
|
||||
export interface InAppBrowserOptions {
|
||||
/** Set to yes or no to turn the InAppBrowser's location bar on or off. */
|
||||
@ -48,6 +48,11 @@ export interface InAppBrowserOptions {
|
||||
/** (Windows only) Set to yes to create the browser control without a border around it.
|
||||
* Please note that if location=no is also specified, there will be no control presented to user to close IAB window. */
|
||||
fullscreen?: 'yes';
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
[key: string]: any;
|
||||
}
|
||||
export interface InAppBrowserEvent extends Event {
|
||||
/** the eventname, either loadstart, loadstop, loaderror, or exit. */
|
||||
@ -80,12 +85,18 @@ export class InAppBrowserObject {
|
||||
*/
|
||||
constructor(url: string, target?: string, options?: string | InAppBrowserOptions) {
|
||||
try {
|
||||
if (options && typeof options !== 'string')
|
||||
options = Object.keys(options).map(key => `${key}=${options[key]}`).join(',');
|
||||
|
||||
if (options && typeof options !== 'string') {
|
||||
options = Object.keys(options).map((key: string) => `${key}=${(<InAppBrowserOptions>options)[key]}`).join(',');
|
||||
}
|
||||
|
||||
this._objectInstance = cordova.InAppBrowser.open(url, target, options);
|
||||
|
||||
} catch (e) {
|
||||
window.open(url);
|
||||
|
||||
window.open(url, target);
|
||||
console.warn('Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open.');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
declare var window: any;
|
||||
declare const window: any;
|
||||
|
||||
export interface IntelSecurityDataOptions {
|
||||
/** Non-empty string. **/
|
||||
|
@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var cordova: any;
|
||||
declare const cordova: any;
|
||||
|
||||
/**
|
||||
* @name Jins Meme
|
||||
|
@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var navigator: any;
|
||||
declare const navigator: any;
|
||||
|
||||
export interface MediaFile {
|
||||
/**
|
||||
@ -33,7 +33,7 @@ export interface MediaFile {
|
||||
* @param {Function} successCallback
|
||||
* @param {Function} errorCallback
|
||||
*/
|
||||
getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any);
|
||||
getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any): void;
|
||||
}
|
||||
|
||||
export interface MediaFileData {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaInstance, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare var Media: any;
|
||||
declare const Media: any;
|
||||
|
||||
|
||||
/**
|
||||
@ -169,7 +169,7 @@ export type MediaErrorCallback = (error: MediaError) => void;
|
||||
* window.setTimeout(() => file.stopRecord(), 10000);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* You can find the reasons here: https://github.com/driftyco/ionic-native/issues/1452#issuecomment-299605906
|
||||
*
|
||||
* @usage
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name PayPal
|
||||
* @description
|
||||
@ -383,6 +384,11 @@ export interface PayPalConfigurationOptions {
|
||||
* PIN to use for sandbox if 'forceDefaultsInSandbox' is set.
|
||||
*/
|
||||
sandboxUserPin?: string;
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
[key: string]: any;
|
||||
}
|
||||
/**
|
||||
* @hidden
|
||||
@ -413,7 +419,7 @@ export class PayPalConfiguration implements PayPalConfigurationOptions {
|
||||
};
|
||||
|
||||
if (options && typeof options === 'object') {
|
||||
for (var i in options) {
|
||||
for (let i in options) {
|
||||
if (defaults.hasOwnProperty(i)) {
|
||||
defaults[i] = options[i];
|
||||
}
|
||||
|
@ -2,8 +2,6 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var window;
|
||||
|
||||
/**
|
||||
* @name Screen Orientation
|
||||
* @description
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare const navigator: any;
|
||||
|
||||
declare var navigator: any;
|
||||
/**
|
||||
* @name Screenshot
|
||||
* @description Captures a screen shot
|
||||
@ -44,7 +44,7 @@ export class Screenshot extends IonicNativePlugin {
|
||||
return new Promise<any>(
|
||||
(resolve, reject) => {
|
||||
navigator.screenshot.save(
|
||||
(error, result) => {
|
||||
(error: any, result: any) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
@ -70,7 +70,7 @@ export class Screenshot extends IonicNativePlugin {
|
||||
return new Promise<any>(
|
||||
(resolve, reject) => {
|
||||
navigator.screenshot.URI(
|
||||
(error, result) => {
|
||||
(error: any, result: any) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
|
@ -1,9 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
declare var window;
|
||||
|
||||
/**
|
||||
* @name Status Bar
|
||||
* @description
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaInstance, Plugin, InstanceCheck, checkAvailability, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
declare var FileTransfer;
|
||||
declare const FileTransfer: any;
|
||||
|
||||
export interface FileUploadOptions {
|
||||
|
||||
|
@ -28,9 +28,9 @@ export interface MediaFile {
|
||||
/**
|
||||
* Retrieves the format information of the media file.
|
||||
* @param {Function} successCallback
|
||||
* @param {Function} errorCallback
|
||||
* @param {Function} [errorCallback]
|
||||
*/
|
||||
getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any);
|
||||
getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any): any;
|
||||
}
|
||||
|
||||
export interface MediaFileData {
|
||||
|
@ -2,8 +2,6 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
declare var window;
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @name Web Intent
|
||||
|
@ -5,6 +5,7 @@
|
||||
"stripInternal": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"noImplicitAny": true,
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"paths": {
|
||||
|
Loading…
Reference in New Issue
Block a user