mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-19 00:12:53 +08:00
fix(secure-storage): import getPromise
This commit is contained in:
parent
e661f2ece9
commit
653f5a2969
@ -1,13 +1,11 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { CordovaCheck, CordovaInstance, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
import { CordovaCheck, CordovaInstance, IonicNativePlugin, Plugin, getPromise } from '@ionic-native/core';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
export class SecureStorageObject {
|
export class SecureStorageObject {
|
||||||
|
constructor(private _objectInstance: any) {}
|
||||||
constructor(private _objectInstance: any) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a stored item
|
* Gets a stored item
|
||||||
@ -76,7 +74,6 @@ export class SecureStorageObject {
|
|||||||
secureDevice(): Promise<any> {
|
secureDevice(): Promise<any> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,7 +131,6 @@ export class SecureStorageObject {
|
|||||||
})
|
})
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SecureStorage extends IonicNativePlugin {
|
export class SecureStorage extends IonicNativePlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a namespaced storage.
|
* Creates a namespaced storage.
|
||||||
* @param store {string}
|
* @param store {string}
|
||||||
@ -143,8 +139,11 @@ export class SecureStorage extends IonicNativePlugin {
|
|||||||
@CordovaCheck()
|
@CordovaCheck()
|
||||||
create(store: string): Promise<SecureStorageObject> {
|
create(store: string): Promise<SecureStorageObject> {
|
||||||
return getPromise<SecureStorageObject>((res: Function, rej: Function) => {
|
return getPromise<SecureStorageObject>((res: Function, rej: Function) => {
|
||||||
const instance = new (SecureStorage.getPlugin())(() => res(new SecureStorageObject(instance)), rej, store);
|
const instance = new (SecureStorage.getPlugin())(
|
||||||
|
() => res(new SecureStorageObject(instance)),
|
||||||
|
rej,
|
||||||
|
store
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user