Skip to content

Commit f5d79ac

Browse files
author
Sven Scholz
committed
Added body, icon, tag ,renotify to controller.js for mercure-notifier
1 parent 416753f commit f5d79ac

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/Notify/assets/dist/controller.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ class default_1 extends Controller {
2626
return;
2727
}
2828
this.eventSources.forEach((eventSource) => {
29-
const listener = (event) => this._notify(JSON.parse(event.data).summary);
29+
const listener = (event) => this._notify(JSON.parse(event.data).summary, JSON.parse(event.data).tag,JSON.parse(event.data).body, JSON.parse(event.data).icon, JSON.parse(event.data).renotify);
30+
3031
eventSource.addEventListener('message', listener);
3132
this.listeners.set(eventSource, listener);
3233
});
@@ -42,17 +43,19 @@ class default_1 extends Controller {
4243
});
4344
this.eventSources = [];
4445
}
45-
_notify(content) {
46+
_notify(content, tag, body, icon, renotify) {
4647
if (!content)
4748
return;
49+
if (!tag)
50+
tag = ''
4851
if ('granted' === Notification.permission) {
49-
new Notification(content);
52+
new Notification(content, {tag: tag, body: body, icon: icon, renotify: renotify});
5053
return;
5154
}
5255
if ('denied' !== Notification.permission) {
5356
Notification.requestPermission().then((permission) => {
5457
if ('granted' === permission) {
55-
new Notification(content);
58+
new Notification(content, {tag: tag, body: body, icon: icon, renotify: renotify});
5659
}
5760
});
5861
}

0 commit comments

Comments
 (0)