2022-02-17 18:09:57 +01:00
|
|
|
import path from "path";
|
|
|
|
import { Notification, NotificationConstructorOptions } from "electron";
|
|
|
|
|
2022-02-18 23:03:05 +01:00
|
|
|
export function createNotification(options: Partial<NotificationConstructorOptions>) {
|
|
|
|
const notification = new Notification({
|
|
|
|
title: "WorkAdventure",
|
|
|
|
icon: path.join(__dirname, "..", "assets", "icons", "logo.png"),
|
|
|
|
...(options || {}),
|
|
|
|
});
|
2022-02-17 18:09:57 +01:00
|
|
|
|
2022-02-18 23:03:05 +01:00
|
|
|
return notification;
|
2022-02-17 18:09:57 +01:00
|
|
|
}
|
|
|
|
|
2022-02-18 23:03:05 +01:00
|
|
|
export function createAndShowNotification(options: Partial<NotificationConstructorOptions>) {
|
|
|
|
const notification = createNotification(options);
|
2022-02-17 18:09:57 +01:00
|
|
|
|
2022-02-18 23:03:05 +01:00
|
|
|
notification.show();
|
2022-02-17 18:09:57 +01:00
|
|
|
|
2022-02-18 23:03:05 +01:00
|
|
|
return notification;
|
2022-02-17 18:09:57 +01:00
|
|
|
}
|