mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 15:47:35 +00:00
feat(notification): add desktop notifications (#140)
Co-authored-by: Jef LeCompte <jeffreylec@gmail.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import notifier from 'node-notifier';
|
||||
import {Link} from '../store/model';
|
||||
|
||||
export function sendDesktopNotification(cartUrl: string, link: Link) {
|
||||
(async () => {
|
||||
const title = link.brand + ' ' + link.model + ' IN STOCK';
|
||||
const message = cartUrl;
|
||||
|
||||
notifier.notify({
|
||||
title,
|
||||
message
|
||||
});
|
||||
})();
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import {sendSlackMessage} from './slack';
|
||||
import {sendPushoverNotification} from './pushover';
|
||||
import {sendTelegramMessage} from './telegram';
|
||||
import {sendDiscordMessage} from './discord';
|
||||
import {sendDesktopNotification} from './desktop';
|
||||
|
||||
import {Link} from '../store/model';
|
||||
|
||||
const notifications = Config.notifications;
|
||||
@@ -41,4 +43,8 @@ export function sendNotification(cartUrl: string, link: Link) {
|
||||
if (notifications.playSound) {
|
||||
playSound();
|
||||
}
|
||||
|
||||
if (notifications.desktop) {
|
||||
sendDesktopNotification(cartUrl, link);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user