User:Incongruence/chat.js/balloons.js

// balloons.js - Notification system for Wikia chats. By Incongruence.

// Time to keep the notifications open for. const KEEP_TIME = 2734;

function Message(message) { this.display = function { if(Notification.permission == "granted") { var msg = new Notification(message.attributes.name, {icon: message.attributes.avatarSrc, body: message.attributes.text}); setTimeout(function {       msg.close;      }, KEEP_TIME); } } }

Notification.requestPermission(function(status) { if(status == "granted") {    mainRoom.model.chats.bind("afteradd", function(message) { new Message(message).display; }); } });