Use AngularJS promise if available

This commit is contained in:
Ibby Hadeed
2017-12-29 10:15:44 -05:00
parent fc9dcc8e64
commit 0cc1a2b2ff
8 changed files with 64 additions and 49 deletions
+3 -2
View File
@@ -5,7 +5,8 @@ import {
CordovaInstance,
InstanceProperty,
IonicNativePlugin,
Plugin
Plugin,
getPromise
} from '@ionic-native/core';
declare const sqlitePlugin: any;
@@ -192,7 +193,7 @@ export class SQLite extends IonicNativePlugin {
*/
@CordovaCheck()
create(config: SQLiteDatabaseConfig): Promise<SQLiteObject> {
return new Promise((resolve, reject) => {
return getPromise<SQLiteObject>((resolve, reject) => {
sqlitePlugin.openDatabase(config, (db: any) => resolve(new SQLiteObject(db)), reject);
});
}