1.4.0 • Published 3 months ago

notify-manager-electron v1.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Notify Manager

Info

You can test the library with npm run test or npm run test.reply. And also see the source code of examples

Approximate result:

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.

Demo

Standart notify

Example: Click

Demo:

https://github.com/zxcnoname666/notify-manager-electron/assets/156155219/57532a45-d0d2-46bf-bf6f-ba21df3a799b

Reply notify

Example: Click

Demo:

https://github.com/zxcnoname666/notify-manager-electron/assets/156155219/3d0215f1-31c1-436f-84c9-48c9bb58573b

How to use

Creating a NotifyManager

// 1 - bottom-right;
// 2 - top-right;
// 3 - top-left;
// 4 - bottom-left;
const _manager = new NotifyManager(1, '/* your custom style */');

Creating a Notify

Basic notify

const notify = new Notify('Title of notify', 'Body of notify. HTML allowed.');

// show notify
_manager.show(notify);

Hook onDestroy of 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);

Hook onclick of notify

const notify = new Notify('Click hook', 'Click on the notify.');

// show notify
_manager.show(notify, () => {
    console.log('clicked on the notify');
    //..... other code
});

Open an external link when click on the notify

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'));

Notification with image & custom duration

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);

Notify with sound

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);

You can also use the file:// protocol as a link (for images and sounds)
1.4.0

3 months ago

1.3.1

4 months ago

1.2.0

12 months ago

1.3.0

9 months ago

1.2.1

10 months ago

1.1.1

1 year ago

1.1.0

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago