MediaWiki:FandomizedChat/events.js

var ChatEvents = $.extend(typeof ChatEvents !== 'undefined' ? ChatEvents : {}, {   'afteradd': function{        return new Promise(function(resolve, reject){ mainRoom.model.chats.bind('afteradd', function(child){               if (typeof child !== 'undefined'){                    resolve(child);                } else {                    reject;                }            }); });   },    'updateUsers': function{        return new Promise(function(resolve, reject){ setInterval(function{               var users = mainRoom.model.users.map(function(child){ return child.attributes.name; }).sort;               if (users.length){                    resolve(users);                } else {                    reject(users);                }            }, 500); });   } });