http://adodson.com/notification.js/#notificationjs
■ Demo
http://falsam.com/sbtest/notification.html
■ Code
Code: Select all
;See : http://adodson.com/notification.js/#notificationjs
Procedure.i HeaderInclude(filename.s)
Protected filetype.s = GetExtensionPart(filename)
Select LCase(filetype)
Case "less"
!$('<link rel="stylesheet/less" type="text/css">').attr('href',v_filename).appendTo('head');
Case "css"
!$('<link rel="stylesheet" type="text/css">').attr('href',v_filename).appendTo('head');
Case "js"
!$('<script type="text/javascript"></script>').attr('src',v_filename).appendTo('head');
EndSelect
EndProcedure
CompilerIf #PB_Compiler_IsMainFile
HeaderInclude("assets/js/notification.js")
CompilerEndIf
Procedure InitNotification()
!if(Notification.permission !== 'granted'){
! Notification.requestPermission();
!}
EndProcedure
Procedure SendNotification()
Protected title.s = "Hello"
Protected message.s = "This is your first notification"
Protected icon.s = "assets/images/star.ico"
!n = new Notification( v_title, {
! body: v_message,
! icon : v_icon
!});
EndProcedure
Procedure Start()
InitNotification()
OpenWindow(0, 0, 0, 0, 0, "", #PB_Window_Background)
ButtonGadget(0, 10, 20, 110, 24, "Test notification")
BindGadgetEvent(0, @SendNotification())
EndProcedure
start()
http://falsam.com/sbtest/data/notification.zip