mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 09:57:38 +00:00
21 lines
540 B
TypeScript
21 lines
540 B
TypeScript
import {Link, Store} from '../store/model';
|
|
import {Print, logger} from '../logger';
|
|
import {config} from '../config';
|
|
import notifier from 'node-notifier';
|
|
|
|
const desktop = config.notifications.desktop;
|
|
|
|
export function sendDesktopNotification(link: Link, store: Store) {
|
|
if (desktop) {
|
|
logger.debug('↗ sending desktop notification');
|
|
(async () => {
|
|
notifier.notify({
|
|
message: link.cartUrl ? link.cartUrl : link.url,
|
|
title: Print.inStock(link, store)
|
|
});
|
|
|
|
logger.info('✔ desktop notification sent');
|
|
})();
|
|
}
|
|
}
|