本文整理汇总了TypeScript中@ionic-native/core.CordovaCheck函数的典型用法代码示例。如果您正苦于以下问题:TypeScript CordovaCheck函数的具体用法?TypeScript CordovaCheck怎么用?TypeScript CordovaCheck使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CordovaCheck函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getPromise
/**
* Search for contacts in the Contacts list.
* @param fields {ContactFieldType[]} Contact fields to be used as a search qualifier
* @param options {IContactFindOptions} Optional options for the query
* @returns {Promise<Contact[]>} Returns a Promise that resolves with the search results (an array of Contact objects)
*/
@CordovaCheck()
find(fields: ContactFieldType[], options?: IContactFindOptions): Promise<Contact[]> {
return getPromise((resolve: Function, reject: Function) => {
navigator.contacts.find(fields, (contacts: any[]) => {
resolve(contacts.map(processContact));
}, reject, options);
});
}
示例2: connect
/**
* Establishes connection to JINS MEME.
* @param {string} target
* @returns {Observable<any>}
*/
@CordovaCheck({
observable: true
})
connect(target: string): Observable<any> {
return new Observable<any>((observer: any) => {
let data = cordova.plugins.JinsMemePlugin.connect(target, observer.next.bind(observer), observer.complete.bind(observer), observer.error.bind(observer));
return () => console.log(data);
});
}
示例3: check
/**
* Checks if the printer service is available (iOS) or if printer services are installed and enabled (Android).
* @return {Promise<any>} returns a promise that resolve with an object indicating whether printing is available, and providing the number of printers available
*/
@CordovaCheck()
check(): Promise<any> {
return new Promise<any>((resolve: Function) => {
Printer.getPlugin()
.check((avail: boolean, count: any) => {
resolve({ avail, count });
});
});
}
示例4: deploy
/**
* Ionic Pro Deploy .js API.
*/
@CordovaCheck({ sync: true })
deploy(): ProDeploy {
if (this._deploy) {
return this._deploy;
} else {
this._deploy = new ProDeploy(Pro.getPlugin().deploy);
return this._deploy;
}
}
示例5: isAvailable
/**
* Verifies if sending emails is supported on the device.
*
* @param [app] {string} App id or uri scheme.
* @returns {Promise<any>} Resolves if available, rejects if not available
*/
@CordovaCheck()
isAvailable(app?: string): Promise<any> {
return new Promise<boolean>((resolve, reject) => {
if (app) {
EmailComposer.getPlugin().isAvailable(app, (isAvailable: boolean) => {
if (isAvailable) {
resolve();
} else {
reject();
}
});
} else {
EmailComposer.getPlugin().isAvailable((isAvailable: boolean) => {
if (isAvailable) {
resolve();
} else {
reject();
}
});
}
});
}
示例6: Promise
/**
* Creates a namespaced storage.
* @param store {string}
* @returns {Promise<SecureStorageObject>}
*/
@CordovaCheck()
create(store: string): Promise<SecureStorageObject> {
return new Promise((res: Function, rej: Function) => {
const instance = new (SecureStorage.getPlugin())(() => res(new SecureStorageObject(instance)), rej, store);
});
}
示例7: BeaconRegion
/**
* Creates a new BeaconRegion
*
* @param {String} identifier @see {CLRegion}
* @param {String} uuid The proximity ID of the beacon being targeted.
* This value must not be blank nor invalid as a UUID.
* @param {Number} major The major value that you use to identify one or more beacons.
* @param {Number} minor The minor value that you use to identify a specific beacon.
* @param {BOOL} notifyEntryStateOnDisplay
*
* @returns {BeaconRegion} Returns the BeaconRegion that was created
*/
@CordovaCheck({ sync: true })
BeaconRegion(identifer: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion {
return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay);
}
示例8: Delegate
/**
* Instances of this class are delegates between the {@link LocationManager} and
* the code that consumes the messages generated on in the native layer.
*
* @returns {IBeaconDelegate} An instance of the type {@type Delegate}.
*/
@CordovaCheck({ sync: true })
Delegate(): IBeaconDelegate {
let delegate = new cordova.plugins.locationManager.Delegate();
delegate.didChangeAuthorizationStatus = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>(
(observer: any) => {
let cb = (data: IBeaconPluginResult) => observer.next(data);
return delegate.didChangeAuthorizationStatus = cb;
}
);
};
delegate.didDetermineStateForRegion = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>(
(observer: any) => {
let cb = (data: IBeaconPluginResult) => observer.next(data);
return delegate.didDetermineStateForRegion = cb;
}
);
};
delegate.didEnterRegion = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>(
(observer: any) => {
let cb = (data: IBeaconPluginResult) => observer.next(data);
return delegate.didEnterRegion = cb;
}
);
};
delegate.didExitRegion = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>(
(observer: any) => {
let cb = (data: IBeaconPluginResult) => observer.next(data);
return delegate.didExitRegion = cb;
}
);
};
delegate.didRangeBeaconsInRegion = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>(
(observer: any) => {
let cb = (data: IBeaconPluginResult) => observer.next(data);
return delegate.didRangeBeaconsInRegion = cb;
}
);
};
delegate.didStartMonitoringForRegion = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>(
(observer: any) => {
let cb = (data: IBeaconPluginResult) => observer.next(data);
return delegate.didStartMonitoringForRegion = cb;
}
);
};
delegate.monitoringDidFailForRegionWithError = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>(
(observer: any) => {
let cb = (data: IBeaconPluginResult) => observer.next(data);
return delegate.monitoringDidFailForRegionWithError = cb;
}
);
};
delegate.peripheralManagerDidStartAdvertising = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>(
(observer: any) => {
let cb = (data: IBeaconPluginResult) => observer.next(data);
return delegate.peripheralManagerDidStartAdvertising = cb;
}
);
};
delegate.peripheralManagerDidUpdateState = (pluginResult?: IBeaconPluginResult) => {
return new Observable<IBeaconPluginResult>(
(observer: any) => {
let cb = (data: IBeaconPluginResult) => observer.next(data);
return delegate.peripheralManagerDidUpdateState = cb;
}
);
};
cordova.plugins.locationManager.setDelegate(delegate);
return delegate;
}
示例9: Promise
/**
* Open or create a SQLite database file.
*
* See the plugin docs for an explanation of all options: https://github.com/litehelpers/Cordova-sqlite-storage#opening-a-database
*
* @param config {SQLiteDatabaseConfig} database configuration
* @return Promise<SQLiteObject>
*/
@CordovaCheck()
create(config: SQLiteDatabaseConfig): Promise<SQLiteObject> {
return new Promise((resolve, reject) => {
sqlitePlugin.openDatabase(config, (db: any) => resolve(new SQLiteObject(db)), reject);
});
}