mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-15 21:28:40 -09:00
Show notfications after app is ready
This commit is contained in:
parent
83836f42b8
commit
a8803eca6d
2 changed files with 13 additions and 3 deletions
|
|
@ -16,7 +16,7 @@ const _syntaxValidation = (cfg: string) => {
|
||||||
try {
|
try {
|
||||||
return new vm.Script(cfg, {filename: '.hyper.js', displayErrors: true});
|
return new vm.Script(cfg, {filename: '.hyper.js', displayErrors: true});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
notify('Error loading config:', `${err.name}, see DevTools for more info`, {error: err});
|
notify(`Error loading config: ${err.name}`, `${err}`, {error: err});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import {Notification} from 'electron';
|
import {app, Notification} from 'electron';
|
||||||
import {icon} from './config/paths';
|
import {icon} from './config/paths';
|
||||||
|
|
||||||
export default function notify(title: string, body = '', details: {error?: any} = {}) {
|
export default function notify(title: string, body = '', details: {error?: any} = {}) {
|
||||||
|
|
@ -6,5 +6,15 @@ export default function notify(title: string, body = '', details: {error?: any}
|
||||||
if (details.error) {
|
if (details.error) {
|
||||||
console.error(details.error);
|
console.error(details.error);
|
||||||
}
|
}
|
||||||
new Notification({title, body, ...(process.platform === 'linux' && {icon})}).show();
|
if (app.isReady()) {
|
||||||
|
_createNotification(title, body);
|
||||||
|
} else {
|
||||||
|
app.on('ready', () => {
|
||||||
|
_createNotification(title, body);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _createNotification = (title: string, body: string) => {
|
||||||
|
new Notification({title, body, ...(process.platform === 'linux' && {icon})}).show();
|
||||||
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue