hyper/app/notify.ts

11 lines
356 B
TypeScript
Raw Normal View History

2020-03-04 02:31:19 -09:00
import {Notification} from 'electron';
import {icon} from './config/paths';
2016-07-07 12:48:43 -08:00
2020-03-04 02:31:19 -09:00
export default function notify(title: string, body = '', details: any = {}) {
2020-01-02 05:44:11 -09:00
console.log(`[Notification] ${title}: ${body}`);
if (details.error) {
console.error(details.error);
}
2020-03-04 02:31:19 -09:00
new Notification({title, body, ...(process.platform === 'linux' && {icon})}).show();
2020-01-02 05:44:11 -09:00
}