Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/core/Notification.js
| Show All 20 Lines | JX.install('Notification', { | ||||
| events : ['activate', 'close'], | events : ['activate', 'close'], | ||||
| members : { | members : { | ||||
| _container : null, | _container : null, | ||||
| _visible : false, | _visible : false, | ||||
| _hideTimer : null, | _hideTimer : null, | ||||
| _duration : 12000, | _duration : 12000, | ||||
| _desktopReady : false, | _asDesktop : false, | ||||
| _webReady : false, | |||||
| _key : null, | _key : null, | ||||
| _title : null, | _title : null, | ||||
| _body : null, | _body : null, | ||||
| _href : null, | _href : null, | ||||
| _icon : null, | _icon : null, | ||||
| show : function() { | show : function() { | ||||
| var self = JX.Notification; | var self = JX.Notification; | ||||
| // This person doesn't like any real-time notification | |||||
| if (!this._desktopReady && !this._webReady) { | |||||
| return; | |||||
| } | |||||
| if (!this._visible) { | if (!this._visible) { | ||||
| this._visible = true; | this._visible = true; | ||||
| self._show(this); | self._show(this); | ||||
| this._updateTimer(); | this._updateTimer(); | ||||
| } | } | ||||
| if (self.supportsDesktopNotifications() && | if (self.supportsDesktopNotifications() && | ||||
| self.desktopNotificationsEnabled() && | self.desktopNotificationsEnabled() && | ||||
| this._desktopReady) { | this._asDesktop) { | ||||
| // Note: specifying "tag" means that notifications with matching | // Note: specifying "tag" means that notifications with matching | ||||
| // keys will aggregate. | // keys will aggregate. | ||||
| var n = new window.Notification(this._title, { | var n = new window.Notification(this._title, { | ||||
| icon: this._icon, | icon: this._icon, | ||||
| body: this._body, | body: this._body, | ||||
| tag: this._key, | tag: this._key, | ||||
| }); | }); | ||||
| n.onclick = JX.bind(n, function (href) { | n.onclick = JX.bind(n, function (href) { | ||||
| Show All 26 Lines | alterClassName : function(name, enable) { | ||||
| return this; | return this; | ||||
| }, | }, | ||||
| setContent : function(content) { | setContent : function(content) { | ||||
| JX.DOM.setContent(this._getContainer(), content); | JX.DOM.setContent(this._getContainer(), content); | ||||
| return this; | return this; | ||||
| }, | }, | ||||
| setDesktopReady : function(ready) { | setShowAsDesktopNotification : function(mode) { | ||||
| this._desktopReady = ready; | this._asDesktop = mode; | ||||
| return this; | |||||
| }, | |||||
| setWebReady : function(ready) { | |||||
| this._webReady = ready; | |||||
| return this; | return this; | ||||
| }, | }, | ||||
| setTitle : function(title) { | setTitle : function(title) { | ||||
| this._title = title; | this._title = title; | ||||
| return this; | return this; | ||||
| }, | }, | ||||
| ▲ Show 20 Lines • Show All 155 Lines • Show Last 20 Lines | |||||