javascript - YUI custom event default function not executing -
why default function event not execute when specify defaultfn?
var node = y.one(".foo"); node.publish("myevent", { defaultfn: function () { //i don't understand why doesn't execute //i expect execute after on listener //and before after listener y.log("in default function"); } }); node.before("myevent", function () { y.log("in before listener"); }); node.on("myevent", function () { y.log("in on listener"); }); node.after("myevent", function () { y.log("in after listener"); }); node.fire("myevent"); jsfiddle: http://jsfiddle.net/steaks/ruacd/
your jsfiddle shows loading node. have events, have load 1 of event modules. happens, code fails @ call publish, first method event provides finds.
in general, check api docs methods fail , see module provides them ('inherited from' right below heading method) , make sure have corresponding module loaded.
-- updated according newer jsfiddle:
add emitfacade: true configuration of published event. yui automatically classes inheriting base not others. node instances, have add option explicitly.
Comments
Post a Comment