mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-16 21:58:39 -09:00
close chokidar watcher before quit
This commit is contained in:
parent
b6c2eb6478
commit
14a34d33dd
1 changed files with 10 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import win from './config/windows';
|
||||||
import {cfgPath, cfgDir} from './config/paths';
|
import {cfgPath, cfgDir} from './config/paths';
|
||||||
import {getColorMap} from './utils/colors';
|
import {getColorMap} from './utils/colors';
|
||||||
import {parsedConfig, configOptions} from '../lib/config';
|
import {parsedConfig, configOptions} from '../lib/config';
|
||||||
|
import {app} from 'electron';
|
||||||
|
|
||||||
const watchers: Function[] = [];
|
const watchers: Function[] = [];
|
||||||
let cfg: parsedConfig = {} as any;
|
let cfg: parsedConfig = {} as any;
|
||||||
|
|
@ -54,6 +55,15 @@ const _watch = () => {
|
||||||
_watcher.on('error', (error) => {
|
_watcher.on('error', (error) => {
|
||||||
console.error('error watching config', error);
|
console.error('error watching config', error);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.on('before-quit', (e) => {
|
||||||
|
if (Object.keys(_watcher.getWatched()).length > 0) {
|
||||||
|
e.preventDefault();
|
||||||
|
_watcher.close().then(() => {
|
||||||
|
app.quit();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const subscribe = (fn: Function) => {
|
export const subscribe = (fn: Function) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue