Create beautiful and functional notifications on electron
You can test the library with npm run test
or npm run test.reply
. And also see the source code of examples
You can change the appearance of the notification by adding your style when creating the NotifyManager
You can use your own sounds when showing a notification.
Example: Click
Demo:
demo1.mp4
Example: Click
Demo:
demo2.mp4
// 1 - bottom-right;
// 2 - top-right;
// 3 - top-left;
// 4 - bottom-left;
const _manager = new NotifyManager(1, '/* your custom style */');
const notify = new Notify('Title of notify', 'Body of notify. HTML allowed.');
// show notify
_manager.show(notify);
const notify = new Notify('Test notify', 'Test.');
notify.onDestroy(() => console.log('destroyed'));
notify.onDestroy(() => console.log('2nd console log of notify destroy'));
// show notify
_manager.show(notify);
const notify = new Notify('Click hook', 'Click on the notify.');
// show notify
_manager.show(notify, () => {
console.log('clicked on the notify');
//..... other code
});
const { shell } = require('electron');
const notify = new Notify('Click hook', 'Click to open link');
_manager.show(notify, () => shell.openExternal('https://github.com/zxcnoname666/notify-manager-electron'));
Recommended image size - 55x55px
const duration = 30; // in seconds
const notify = new Notify('Your App', 'Your beautiful message', duration, 'https://github.com/favicon.ico');
// show notify
_manager.show(notify);
Attention: It is not recommended to use music playing for a long time. Instead, use sounds up to 10 seconds long.
// url, volume
const sound = new NotifySound('https://github.com/zxcnoname666/repo-files/raw/main/notify-manager-electron/meow1.mp3', 50);
const body = '<span style="color:red !important;">text</span>';
const image = 'https://github.com/zxcnoname666/SoundCloud-Desktop/raw/main/icons/appLogo.png';
const notify = new Notify('notify with sound & html', body, 60, image, sound);
// show notify
_manager.show(notify);