forked from dpa99c/cordova-plugin-cloud-settings
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcordova-plugin-cloud-settings.d.ts
71 lines (62 loc) · 3.13 KB
/
cordova-plugin-cloud-settings.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Type definitions for cordova-plugin-cloud-settings
// Project: https://github.com/dpa99c/cordova-diagnostic-plugin
// Definitions by: Dave Alden <https://github.com/dpa99c/>
/// <reference types="cordova" />
/**
* Provides a mechanism to store key/value app settings in the form of a JSON structure which will persist in cloud storage so if the user re-installs the app or installs it on a different device, the settings will be restored and available in the new installation.
*/
interface CloudSettings {
/**
* Outputs verbose log messages from the native plugin components to the JS console.
* @param {function} successCallback - callback function to invoke when debug mode has been enabled
*/
enableDebug: (
successCallback: () => void,
) => void;
/**
* Indicates if any stored cloud settings currently exist for the current user.
* @param {function} successCallback - callback function to invoke with the result.
* Will be passed a boolean flag which indicates whether an store settings exist for the user.
*/
exists: (
successCallback: (available: boolean) => void,
) => void;
/**
* Saves the settings to cloud backup.
* @param {object} settings - a JSON structure representing the user settings to save to cloud backup.
* @param {function} successCallback - (optional) callback function to invoke on successfuly saving settings and scheduling for backup.
Will be passed a single object argument which contains the saved settings as a JSON object.
* @param {function} errorCallback - (optional) callback function to invoke on failure to save settings or schedule for backup.
Will be passed a single string argument which contains a description of the error.
* @param {boolean} overwrite - (optional) if true, existing settings will be replaced rather than updated. Defaults to false.
- If false, existing settings will be merged with the new settings passed to this function.
*/
save: (
settings: object,
successCallback: (savedSettings: object) => void,
errorCallback: (error: string) => void,
overwrite?: boolean
) => void;
/**
* Loads the current settings.
* @param {settings
* @param {function} successCallback - (optional) callback function to invoke on successfuly loading settings.
Will be passed a single object argument which contains the current settings as a JSON object.
* {function} errorCallback - (optional) callback function to invoke on failure to load settings.
Will be passed a single string argument which contains a description of the error.
*/
load: (
successCallback: (savedSettings: object) => void,
errorCallback: (error: string) => void
) => void;
/**
* Registers a function which will be called if/when settings on the device have been updated from the cloud.
* @param {function} successCallback - callback function to invoke when device settings have been updated from the cloud.
*/
onRestore: (
successCallback: () => void,
) => void;
}
interface CordovaPlugin {
cloudsettings: CloudSettings
}