dojo: aspect.after is not working -
guys have been trying since hour. unable figure out why aspect.after/before not being called. code.
require([ "dojo/aspect", "dojo/on", "dojo/dom", "dojo/domready!" ], function( aspect, on, registry, dom) { var callback = function() { alert("called click"); }; var callback2 = function() { alert("called click 2"); }; var = { clicking : on(dom.byid("alertbutton"), "click", callback) }; aspect.after(my, "clicking", callback2); });
thanks in advance.
maybe confusing usage.
aspect.after
or aspect.before
, execute additional functions base on methods. not action.
example:
aspect.after(my, "clicking", callback2);
anywhere calling my.clicking()
run callback2
.
not execute additional function when running on(dom.byid("alertbutton"), "click", callback)
.
my english not good, simple explain:
function a(){ alert(); } my.clicking = function(){ a(); }; aspect.after(my, "clicking", callback2); //equals my.clicking = function(){ a(); callback2(); }; //but not equals function a(){ alert(); callback2(); }
Comments
Post a Comment