diff options
-rw-r--r-- | src/webview/notifications.ts | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/webview/notifications.ts b/src/webview/notifications.ts index 7f6ce01fd..aa88f13a2 100644 --- a/src/webview/notifications.ts +++ b/src/webview/notifications.ts | |||
@@ -37,12 +37,22 @@ export const notificationsClassDefinition = `(() => { | |||
37 | constructor(title = '', options = {}) { | 37 | constructor(title = '', options = {}) { |
38 | this.title = title; | 38 | this.title = title; |
39 | this.options = options; | 39 | this.options = options; |
40 | window.ferdium.displayNotification(title, options) | 40 | try{ |
41 | .then(() => { | 41 | window.ferdium.displayNotification(title, options) |
42 | if (typeof (this.onClick) === 'function') { | 42 | .then(() => { |
43 | this.onClick(); | 43 | if (typeof (this.onClick) === 'function') { |
44 | } | 44 | this.onClick(); |
45 | }); | 45 | } |
46 | }); | ||
47 | } catch(error) { | ||
48 | this.options.onClick = null; | ||
49 | window.ferdium.displayNotification(title, options) | ||
50 | .then(() => { | ||
51 | if (typeof (this.onClick) === 'function') { | ||
52 | this.onClick(); | ||
53 | } | ||
54 | }); | ||
55 | } | ||
46 | } | 56 | } |
47 | 57 | ||
48 | static requestPermission(cb = null) { | 58 | static requestPermission(cb = null) { |