UNPKG

1.76 kBTypeScriptView Raw
1import { IonicNativePlugin } from '@ionic-native/core';
2/**
3 * @name Native Storage
4 * @premier nativestorage
5 * @description Native storage of variables in Android and iOS
6 *
7 * @usage
8 * ```typescript
9 * import { NativeStorage } from '@ionic-native/native-storage/ngx';
10 *
11 * constructor(private nativeStorage: NativeStorage) { }
12 *
13 * ...
14 *
15 * this.nativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'})
16 * .then(
17 * () => console.log('Stored item!'),
18 * error => console.error('Error storing item', error)
19 * );
20 *
21 * this.nativeStorage.getItem('myitem')
22 * .then(
23 * data => console.log(data),
24 * error => console.error(error)
25 * );
26 * ```
27 */
28export declare class NativeStorageOriginal extends IonicNativePlugin {
29 /**
30 * Initialises shared storage with the suite name when using app groups in iOS
31 * @param reference {string}
32 * @returns {Promise<void>}
33 */
34 initWithSuiteName(reference: string): Promise<void>;
35 /**
36 * Stores a value
37 * @param reference {string}
38 * @param value
39 * @returns {Promise<any>}
40 */
41 setItem(reference: string, value: any): Promise<any>;
42 /**
43 * Gets a stored item
44 * @param reference {string}
45 * @returns {Promise<any>}
46 */
47 getItem(reference: string): Promise<any>;
48 /**
49 * Retrieving all keys
50 * @returns {Promise<any>}
51 */
52 keys(): Promise<any>;
53 /**
54 * Removes a single stored item
55 * @param reference {string}
56 * @returns {Promise<any>}
57 */
58 remove(reference: string): Promise<any>;
59 /**
60 * Removes all stored values.
61 * @returns {Promise<any>}
62 */
63 clear(): Promise<any>;
64}
65
66export declare const NativeStorage: NativeStorageOriginal;
\No newline at end of file