2019-10-10 11:20:26 -08:00
|
|
|
const Config = require('electron-store');
|
2017-06-02 16:03:47 -08:00
|
|
|
|
2018-03-02 12:11:33 -09:00
|
|
|
const defaults = {
|
|
|
|
|
windowPosition: [50, 50],
|
|
|
|
|
windowSize: [540, 380]
|
|
|
|
|
};
|
|
|
|
|
|
2017-06-02 16:03:47 -08:00
|
|
|
// local storage
|
2018-03-02 12:11:33 -09:00
|
|
|
const cfg = new Config({defaults});
|
2017-06-02 16:03:47 -08:00
|
|
|
|
|
|
|
|
module.exports = {
|
2018-03-02 12:11:33 -09:00
|
|
|
defaults,
|
2017-06-02 16:03:47 -08:00
|
|
|
get() {
|
|
|
|
|
const position = cfg.get('windowPosition');
|
|
|
|
|
const size = cfg.get('windowSize');
|
|
|
|
|
return {position, size};
|
|
|
|
|
},
|
|
|
|
|
recordState(win) {
|
|
|
|
|
cfg.set('windowPosition', win.getPosition());
|
|
|
|
|
cfg.set('windowSize', win.getSize());
|
|
|
|
|
}
|
|
|
|
|
};
|