* SetOptions * @typedef {Object} SetOptions * @property {String} Key * @property {any} value Value
| 8 | */ |
| 9 | |
| 10 | class AppData { |
| 11 | /** |
| 12 | * Set an item. |
| 13 | * @param {String} key |
| 14 | * @param {?any} value |
| 15 | */ |
| 16 | static set(key, value) { |
| 17 | ipcRenderer.send('AppData', 'set', [key, value]) |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Get an item. |
| 22 | * @param {String} key The key of the item to get. |
| 23 | * @param {?any} defaultValue The default value to return if item does not exist. |
| 24 | * @returns {any} |
| 25 | */ |
| 26 | static get(key, defaultValue) { |
| 27 | return ipcRenderer.sendSync('AppData', 'get', [key, defaultValue]) |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Check if an item exists. |
| 32 | * @param {String} key The key of the item to check. |
| 33 | * @returns {boolean} |
| 34 | */ |
| 35 | static has(key) { |
| 36 | return ipcRenderer.sendSync('AppData', 'has', key) |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Delete an item. |
| 41 | * @param {String} key The key of the item to delete. |
| 42 | */ |
| 43 | static delete(key) { |
| 44 | ipcRenderer.send('AppData', 'delete', key) |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | export default AppData |
nothing calls this directly
no outgoing calls
no test coverage detected