Scylla/static/js/notifications.js

17 lines
429 B
JavaScript
Raw Normal View History

if("Notification" in window) {
Notification.requestPermission();
}
function setupNotificationPorts(app) {
app.ports.sendNotificationPort.subscribe(function(data) {
var options = {
"body" : data.text
}
var n = new Notification(data.name, options)
n.onclick = function() {
2018-12-13 14:06:15 -08:00
app.ports.onNotificationClickPort.send(data.room);
n.close();
}
})
}