-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathNotificationNode.js
executable file
·44 lines (44 loc) · 1.33 KB
/
NotificationNode.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
define([ "dojo/text", "dojo/_base/declare", "dijit/_WidgetBase", "dijit/_TemplatedMixin", "dojo/dom-construct", "dojo/dom-class", "dojo/_base/event", "dojo/_base/lang", "dojo/text!./NotificationNode.html"],
function(t, declare, base, templated, domCon, NotificationNode, domClass, event, lang, templateString)
{
return declare('dGrowl',
[base, templated],
{
'templateString':templateString,
'title':'',
'message':'',
'duration':5000,
'sticky':false,
'stickyClass':'',
'constructor':function(a)
{
if(a.channel == undefined)
console.error('NotificationNode requires a "channel" definition!');
if(a.sticky === true)
this.stickyClass = 'dGrowl-notification-sticky';
},
'postCreate':function()
{
this.inherited(arguments);
if(this.sticky === false)
setTimeout(lang.hitch(this, this.killme), this.duration);
},
'show':function()
{
var v = this.domNode.clientHeight; // trigger reflow so transition animates... hack!!!!!!!
domClass.add(this.domNode, 'dGrowl-visible');
this.onShow(this);
},
'onShow':function(){},
'onHide':function(){},
'killme':function(evt)
{
if(evt)
event.stop(evt);
// delay on destroy for animation to do its thing...
domClass.remove(this.domNode, 'dGrowl-visible');
setTimeout(lang.hitch(this, this.destroy),1100);
this.onHide(this);
}
});
});