UNPKG

1.24 kBTypeScriptView Raw
1/**
2 * @name NativeStorage
3 * @description Native storage of variables in Android and iOS
4 *
5 * @usage
6 * ```typescript
7 * import { NativeStorage } from 'ionic-native';
8 *
9 * NativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'})
10 * .then(
11 * () => console.log('Stored item!'),
12 * error => console.error('Error storing item', error)
13 * );
14 *
15 * NativeStorage.getItem('myitem')
16 * .then(
17 * data => console.log(data),
18 * error => console.error(error)
19 * );
20 * ```
21 */
22export declare class NativeStorage {
23 /**
24 * Stores a value
25 * @param reference {string}
26 * @param value
27 * @returns {Promise<any>}
28 */
29 static setItem(reference: string, value: any): Promise<any>;
30 /**
31 * Gets a stored item
32 * @param reference {string}
33 * @returns {Promise<any>}
34 */
35 static getItem(reference: string): Promise<any>;
36 /**
37 * Removes a single stored item
38 * @param reference {string}
39 * @returns {Promise<any>}
40 */
41 static remove(reference: string): Promise<any>;
42 /**
43 * Removes all stored values.
44 * @returns {Promise<any>}
45 */
46 static clear(): Promise<any>;
47}