当我用 指定事件的默认函数时,为什么它不执行defaultFn
?
var node = Y.one(".foo");
node.publish("myEvent", {
defaultFn: function () {
//I don't understand why this doesn't execute
//I expect it to execute after my on listener
//and before my 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/