|
| 1 | +// Type definitions for electron-store 1.2.0 |
| 2 | +// Project: https://github.com/sindresorhus/electron-store |
| 3 | +// TypeScript Version: 2.4.0 |
| 4 | + |
| 5 | +declare module 'electron-store' { |
| 6 | + interface ElectronStoreOptions { |
| 7 | + /** Default data. */ |
| 8 | + defaults?: {} |
| 9 | + |
| 10 | + /** Name of the storage file (without extension). Default is `config`. */ |
| 11 | + name?: string |
| 12 | + |
| 13 | + /** Storage file location. Don't specify this unless absolutely necessary! */ |
| 14 | + cwd?: string |
| 15 | + } |
| 16 | + |
| 17 | + /** |
| 18 | + * Simple data persistence for your Electron app or module. |
| 19 | + * |
| 20 | + * You can use dot-notation in a key to access nested properties. The instance is iterable |
| 21 | + * so you can use it directly in a for…of loop. |
| 22 | + */ |
| 23 | + export default class ElectronStore |
| 24 | + implements Iterable<[string, string | number | boolean | symbol | {}]> { |
| 25 | + constructor(options?: ElectronStoreOptions) |
| 26 | + |
| 27 | + [Symbol.iterator](): Iterator<[string, string | number | boolean | symbol | {}]> |
| 28 | + |
| 29 | + /** Set an item. */ |
| 30 | + set(key: string, value: any): void |
| 31 | + |
| 32 | + /** Set multiple items at once. */ |
| 33 | + set(object: {}): void |
| 34 | + |
| 35 | + /** Get an item or defaultValue if the item does not exist. */ |
| 36 | + get(key: string, defaultValue?: any): any |
| 37 | + |
| 38 | + /** Check if an item exists. */ |
| 39 | + has(key: string): boolean |
| 40 | + |
| 41 | + /** Delete an item. */ |
| 42 | + delete(key: string): void |
| 43 | + |
| 44 | + /** Delete all items. */ |
| 45 | + clear(): void |
| 46 | + |
| 47 | + /** Open the storage file in the user's editor. */ |
| 48 | + openInEditor(): void |
| 49 | + |
| 50 | + /** Get the item count. */ |
| 51 | + size: number |
| 52 | + |
| 53 | + /** Get all the data as an object or replace the current data with an object. */ |
| 54 | + store: {} |
| 55 | + |
| 56 | + /** Get the path to the storage file. */ |
| 57 | + path: string |
| 58 | + } |
| 59 | +} |
0 commit comments