(title: string, body = '', details: {error?: any} = {})
| 2 | import {icon} from './config/paths'; |
| 3 | |
| 4 | export default function notify(title: string, body = '', details: {error?: any} = {}) { |
| 5 | console.log(`[Notification] ${title}: ${body}`); |
| 6 | if (details.error) { |
| 7 | console.error(details.error); |
| 8 | } |
| 9 | if (app.isReady()) { |
| 10 | _createNotification(title, body); |
| 11 | } else { |
| 12 | app.on('ready', () => { |
| 13 | _createNotification(title, body); |
| 14 | }); |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | const _createNotification = (title: string, body: string) => { |
| 19 | new Notification({title, body, ...(process.platform === 'linux' && {icon})}).show(); |
no test coverage detected