]> git.wh0rd.org - tt-rss.git/blame - lib/dojo/Evented.js.uncompressed.js
modify dojo rebuild script to remove uncompressed files
[tt-rss.git] / lib / dojo / Evented.js.uncompressed.js
CommitLineData
f0cfe83e
AD
1define("dojo/Evented", ["./aspect", "./on"], function(aspect, on){
2 // module:
3 // dojo/Evented
4
5 "use strict";
6 var after = aspect.after;
7 function Evented(){
8 // summary:
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:
12 //
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
18 // | });
19 // |
20 // | widget.emit("open", {name:"some event", ...});
21 }
22 Evented.prototype = {
23 on: function(type, listener){
24 return on.parse(this, type, listener, function(target, type){
25 return after(target, 'on' + type, listener, true);
26 });
27 },
28 emit: function(type, event){
29 var args = [this];
30 args.push.apply(args, arguments);
31 return on.emit.apply(on, args);
32 }
33 };
34 return Evented;
35});