UNPKG

2.53 kBTypeScriptView Raw
1import { Observable } from 'rxjs/Observable';
2/**
3 * @name AppPreferences
4 * @description
5 * This plugin allows you to read and write app preferences
6 *
7 * @usage
8 * ```
9 * import { AppPreferences } from 'ionic-native';
10 *
11 * AppPreferences.fetch('key').then((res) => { console.log(res); });
12 *
13 *```
14 */
15export declare class AppPreferences {
16 /**
17 * Get a preference value
18 *
19 * @param {string} dict Dictionary for key (OPTIONAL)
20 * @param {string} key Key
21 * @return {Promise<any>} Returns a promise
22 */
23 static fetch(dict: string, key?: string): Promise<any>;
24 /**
25 * Set a preference value
26 *
27 * @param {string} dict Dictionary for key (OPTIONAL)
28 * @param {string} key Key
29 * @param {string} value Value
30 * @return {Promise<any>} Returns a promise
31 */
32 static store(dict: string, key: string, value?: string): Promise<any>;
33 /**
34 * Remove value from preferences
35 *
36 * @param {string} dict Dictionary for key (OPTIONAL)
37 * @param {string} key Key
38 * @return {Promise<any>} Returns a promise
39 */
40 static remove(dict: string, key?: string): Promise<any>;
41 /**
42 * Clear preferences
43 *
44 * @return {Promise<any>} Returns a promise
45 */
46 static clearAll(): Promise<any>;
47 /**
48 * Show native preferences interface
49 *
50 * @return {Promise<any>} Returns a promise
51 */
52 static show(): Promise<any>;
53 /**
54 * Show native preferences interface
55 *
56 * @param {boolean} subscribe true value to subscribe, false - unsubscribe
57 * @return {Observable<any>} Returns an observable
58 */
59 static watch(subscribe: boolean): Observable<any>;
60 /**
61 * Return named configuration context
62 * In iOS you'll get a suite configuration, on Android — named file
63 * Supports: Android, iOS
64 * @param {string} suiteName suite name
65 * @returns {Object} Custom object, bound to that suite
66 */
67 static suite(suiteName: string): Object;
68 static iosSuite(suiteName: string): Object;
69 /**
70 * Return cloud synchronized configuration context
71 * Currently supports Windows and iOS/macOS
72 * @returns {Object} Custom object, bound to that suite
73 */
74 static cloudSync(): Object;
75 /**
76 * Return default configuration context
77 * Currently supports Windows and iOS/macOS
78 * @returns {Object} Custom Object, bound to that suite
79 */
80 static defaults(): Object;
81}