-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove dojo/aspect as a dep from dojo/on and create Evented and topic…
… modules, refs #12451 !strict git-svn-id: http://svn.dojotoolkit.org/src/dojo/trunk@26489 560b804f-0ae3-0310-86f3-f6aa0a117693
- Loading branch information
Showing
12 changed files
with
97 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
define(["./aspect", "./on"], function(aspect, on){ | ||
// summary: | ||
// The export of this module is a class that can be used as a mixin or base class, | ||
// to add on() and emit() methods to a class | ||
// for listening for events and emiting events: | ||
// |define(["dojo/Evented"], function(Evented){ | ||
// | var EventedWidget = dojo.declare([Evented, dijit._Widget], {...}); | ||
// | widget = new EventedWidget(); | ||
// | widget.on("open", function(event){ | ||
// | ... do something with event | ||
// | }); | ||
// | | ||
// | widget.emit("open", {name:"some event", ...}); | ||
|
||
"use strict"; | ||
var after = aspect.after; | ||
function Evented(){ | ||
} | ||
Evented.prototype = { | ||
on: function(type, listener){ | ||
return on.parse(this, type, listener, function(target, type){ | ||
return after(target, 'on' + type, listener, true); | ||
}); | ||
}, | ||
emit: function(type, event){ | ||
var args = [this]; | ||
args.push.apply(args, arguments); | ||
return on.emit.apply(on, args); | ||
} | ||
}; | ||
return Evented; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.