aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview
diff options
context:
space:
mode:
authorLibravatar André Oliveira <37463445+SpecialAro@users.noreply.github.com>2024-05-16 19:21:55 +0100
committerLibravatar GitHub <noreply@github.com>2024-05-16 19:21:55 +0100
commit98814970905d6d976541ea64bb8e052247c9feda (patch)
treee8a7241d646ba66a040f0112f3aa36dd2d61b924 /src/webview
parent6.7.4-nightly.12 [skip ci] (diff)
downloadferdium-app-98814970905d6d976541ea64bb8e052247c9feda.tar.gz
ferdium-app-98814970905d6d976541ea64bb8e052247c9feda.tar.zst
ferdium-app-98814970905d6d976541ea64bb8e052247c9feda.zip
chore: fix error of .close() (#1766)
Diffstat (limited to 'src/webview')
-rw-r--r--src/webview/notifications.ts32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/webview/notifications.ts b/src/webview/notifications.ts
index 835869f5c..0da86fbba 100644
--- a/src/webview/notifications.ts
+++ b/src/webview/notifications.ts
@@ -34,12 +34,20 @@ export const notificationsClassDefinition = `(() => {
34class Notification { 34class Notification {
35 static permission = 'granted'; 35 static permission = 'granted';
36 36
37 static _notification;
38
37 constructor(title = '', options = {}) { 39 constructor(title = '', options = {}) {
38 window.ferdium.displayNotification(title, options).then(() => { 40 Notification._displayNotification(title, options);
39 // TODO: After several tries, we couldn't find a way to trigger the native notification onclick event. 41 }
40 // This was needed so that user could go to the specific context when clicking on the notification (it only goes to the service now). 42
41 // For now, we don't do anything here 43 static _displayNotification(title, options) {
42 }); 44 Notification._notification = window.ferdium
45 .displayNotification(title, options)
46 .then(() => {
47 // TODO: After several tries, we couldn't find a way to trigger the native notification onclick event.
48 // This was needed so that user could go to the specific context when clicking on the notification (it only goes to the service now).
49 // For now, we don't do anything here
50 });
43 } 51 }
44 52
45 static requestPermission(cb) { 53 static requestPermission(cb) {
@@ -53,6 +61,20 @@ class Notification {
53 onNotify(data) { 61 onNotify(data) {
54 return data; 62 return data;
55 } 63 }
64
65 close() {
66 if (Notification._notification) {
67 Notification._notification = null;
68 }
69 }
70
71 onclick() {}
72
73 onclose() {}
74
75 onerror() {}
76
77 onshow() {}
56} 78}
57 79
58 window.Notification = Notification; 80 window.Notification = Notification;