Skip to content

Commit aa2eb69

Browse files
author
Sven Scholz
committed
correct editing the src file
1 parent 3d8b1ff commit aa2eb69

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/Notify/assets/dist/controller.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ class default_1 extends Controller {
2626
return;
2727
}
2828
this.eventSources.forEach((eventSource) => {
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-
29+
const listener = (event) => this._notify(JSON.parse(event.data).summary);
3130
eventSource.addEventListener('message', listener);
3231
this.listeners.set(eventSource, listener);
3332
});
@@ -43,19 +42,17 @@ class default_1 extends Controller {
4342
});
4443
this.eventSources = [];
4544
}
46-
_notify(content, tag, body, icon, renotify) {
45+
_notify(content) {
4746
if (!content)
4847
return;
49-
if (!tag)
50-
tag = ''
5148
if ('granted' === Notification.permission) {
52-
new Notification(content, {tag: tag, body: body, icon: icon, renotify: renotify});
49+
new Notification(content);
5350
return;
5451
}
5552
if ('denied' !== Notification.permission) {
5653
Notification.requestPermission().then((permission) => {
5754
if ('granted' === permission) {
58-
new Notification(content, {tag: tag, body: body, icon: icon, renotify: renotify});
55+
new Notification(content);
5956
}
6057
});
6158
}

src/Notify/assets/src/controller.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ export default class extends Controller {
5151
}
5252

5353
this.eventSources.forEach((eventSource) => {
54-
const listener = (event: MessageEvent) => this._notify(JSON.parse(event.data).summary);
54+
const listener = (event: MessageEvent) => 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);
55+
5556
eventSource.addEventListener('message', listener);
5657
this.listeners.set(eventSource, listener);
5758
});
@@ -72,19 +73,20 @@ export default class extends Controller {
7273
this.eventSources = [];
7374
}
7475

75-
_notify(content: string | undefined) {
76+
_notify(content: string | undefined, tag: string | undefined, body: string | undefined, icon: string | undefined, renotify: boolean | undefined) {
7677
if (!content) return;
78+
if (!tag) tag = '';
7779

7880
if ('granted' === Notification.permission) {
79-
new Notification(content);
81+
new Notification(content, {tag: tag, body: body, icon: icon, renotify: renotify});
8082

8183
return;
8284
}
8385

8486
if ('denied' !== Notification.permission) {
8587
Notification.requestPermission().then((permission) => {
8688
if ('granted' === permission) {
87-
new Notification(content);
89+
new Notification(content, {tag: tag, body: body, icon: icon, renotify: renotify});
8890
}
8991
});
9092
}

0 commit comments

Comments
 (0)