forked from rhygg/yukino-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
store.js
51 lines (43 loc) · 969 Bytes
/
store.js
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
const ElectronStore = require("electron-store");
/**
* @typedef WindowSizeExtended
* @property {boolean} isMaximized
* @property {boolean} fullscreen
*/
/**
* @typedef {import("electron").Rectangle & WindowSizeExtended} WindowSize
*/
class Store extends ElectronStore {
all() {
return this.store;
}
}
class DataStore {
constructor() {
this.store = new Store();
}
/**
* @returns {WindowSize}
*/
getWindowSize() {
const data = this.store.get("window_size");
return (
data || {
x: undefined,
y: undefined,
width: 800,
height: 600,
isMaximized: false,
fullscreen: false
}
);
}
/**
* @param {WindowSize} size
* @returns {void}
*/
setWindowSize(size) {
this.store.set("window_size", size);
}
}
module.exports = new DataStore();