]>
git.wh0rd.org - tt-rss.git/blob - lib/dojo/Evented.js.uncompressed.js
1 define("dojo/Evented", ["./aspect", "./on"], function(aspect
, on
){
3 // The export of this module is a class that can be used as a mixin or base class,
4 // to add on() and emit() methods to a class
5 // for listening for events and emiting events:
6 // |define(["dojo/Evented"], function(Evented){
7 // | var EventedWidget = dojo.declare([Evented, dijit._Widget], {...});
8 // | widget = new EventedWidget();
9 // | widget.on("open", function(event){
10 // | ... do something with event
13 // | widget.emit("open", {name:"some event", ...});
16 var after
= aspect
.after
;
20 on: function(type
, listener
){
21 return on
.parse(this, type
, listener
, function(target
, type
){
22 return after(target
, 'on' + type
, listener
, true);
25 emit: function(type
, event
){
27 args
.push
.apply(args
, arguments
);
28 return on
.emit
.apply(on
, args
);