server.on('newMessage', function () { var currentCount = 1; var messageCount = $('#messageCount').val(); if (messageCount) { currentCount = parseInt(messageCount, 10); } else { $('body').append('<input id="messageCount"></input>'); } $('#messageCount').val(currentCount + 1); var myNotification = new Notify('New messages', { body: 'You received ' + currentCount + ' new ' + (messageCount > 1 ? 'messages' : 'message') + '!', tag: 'qq.message.received', notifyShow: resetMessageCount }); myNotification.show(); });
Notifier.prototype._pushDefault = function(options) { if (!options) { throw new Error('no push options provided'); } var notification = new Notify('COINS', { body: options.body || null, icon: options.icon || (window.location.origin + '/coins_core/graphics/logo-brain-flat.png'), tag: options.tag || Date.now(), timeout: options.timeout ? (options.timeout/1000) : (this.defaultTimeout/1000), notifyShow: options.notifyShow || null, notifyClose: options.notifyClose || null, notifyClick: options.notifyClick || null, notifyError: options.notifyError || null }); notification.show(); return this; };