]>
git.wh0rd.org - tt-rss.git/blob - lib/dojo/Evented.js.uncompressed.js
1 define("dojo/Evented", ["./aspect", "./on"], function(aspect
, on
){
6 var after
= aspect
.after
;
9 // A class that can be used as a mixin or base class,
10 // to add on() and emit() methods to a class
11 // for listening for events and emitting events:
13 // | define(["dojo/Evented"], function(Evented){
14 // | var EventedWidget = dojo.declare([Evented, dijit._Widget], {...});
15 // | widget = new EventedWidget();
16 // | widget.on("open", function(event){
17 // | ... do something with event
20 // | widget.emit("open", {name:"some event", ...});
23 on: function(type
, listener
){
24 return on
.parse(this, type
, listener
, function(target
, type
){
25 return after(target
, 'on' + type
, listener
, true);
28 emit: function(type
, event
){
30 args
.push
.apply(args
, arguments
);
31 return on
.emit
.apply(on
, args
);