Skip to content

Commit 3465234

Browse files
committed
Fixed #35
----- > Notification.requestPermission() < "granted" = $1 > Notification.requestPermission(function (e){console.log(e)}) [Log] granted
1 parent c950130 commit 3465234

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

WebShell/ViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ class ViewController: NSViewController, WebFrameLoadDelegate, WebUIDelegate {
240240
}
241241

242242
// @wdg Add Notification Support
243-
// Issue: #2
244-
jsContext.evaluateScript("function Notification(myTitle, options){if(typeof options === 'object'){var body,icon,tag;if (typeof options['body'] !== 'undefined'){body=options['body']}if (typeof options['icon'] !== 'undefined'){Notification.note(myTitle, body, options['icon'])}else{Notification.note(myTitle, body)}}else{if(typeof options === 'string'){Notification.note(myTitle, options)}else{Notification.note(myTitle)}}}Notification.length=1;Notification.permission='granted';Notification.requestPermission=function(callback){if(typeof callback === 'function'){callback();return true}else{return true}};window.Notification=Notification;")
243+
// Issue: #2, #35
244+
jsContext.evaluateScript("function Notification(myTitle, options){if(typeof options === 'object'){var body,icon,tag;if (typeof options['body'] !== 'undefined'){body=options['body']}if (typeof options['icon'] !== 'undefined'){Notification.note(myTitle, body, options['icon'])}else{Notification.note(myTitle, body)}}else{if(typeof options === 'string'){Notification.note(myTitle, options)}else{Notification.note(myTitle)}}}Notification.length=1;Notification.permission='granted';Notification.requestPermission=function(callback){if(typeof callback === 'function'){callback('granted');}else{return 'granted'}};window.Notification=Notification;")
245245
let myNofification: @convention(block) (NSString!, NSString?, NSString?) -> Void = { (title:NSString!, message:NSString?, icon:NSString?) in
246246
self.makeNotification(title, message: message!, icon: icon!)
247247
}

0 commit comments

Comments
 (0)