Add notification sending functionality.
This commit is contained in:
12
static/js/notifications.js
Normal file
12
static/js/notifications.js
Normal file
@@ -0,0 +1,12 @@
|
||||
if("Notification" in window) {
|
||||
Notification.requestPermission();
|
||||
}
|
||||
|
||||
function setupNotificationPorts(app) {
|
||||
app.ports.sendNotificationPort.subscribe(function(data) {
|
||||
var options = {
|
||||
"body" : data.text
|
||||
}
|
||||
new Notification(data.name, options)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user