forked from sindresorhus/electron-store
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
55 lines (44 loc) · 1.4 KB
/
index.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
/// <reference types="node"/>
import EventEmitter = require('events');
import {Omit} from 'type-fest';
import Conf = require('conf');
declare namespace ElectronStore {
type Options<T> = Omit<
Conf.Options<T>,
'configName' | 'projectName' | 'projectSuffix'
> & {
/**
Name of the storage file (without extension).
This is useful if you want multiple storage files for your app. Or if you're making a reusable Electron module that persists some data, in which case you should **not** use the name `config`.
@default 'config'
*/
readonly name?: string;
};
}
declare class ElectronStore<T> extends Conf<T> {
/**
Simple data persistence for your [Electron](https://electronjs.org) app or module - Save and load user preferences, app state, cache, etc.
Changes are written to disk atomically, so if the process crashes during a write, it will not corrupt the existing config.
@example
```
import Store = require('electron-store');
const store = new Store();
store.set('unicorn', '🦄');
console.log(store.get('unicorn'));
//=> '🦄'
// Use dot-notation to access nested properties
store.set('foo.bar', true);
console.log(store.get('foo'));
//=> {bar: true}
store.delete('unicorn');
console.log(store.get('unicorn'));
//=> undefined
```
*/
constructor(options?: ElectronStore.Options<T>);
/**
Open the storage file in the user's editor.
*/
openInEditor(): void;
}
export = ElectronStore;