Search code examples
javascriptyuiyui3

YUI3 calling a function


top.on('click', function(){
    anim.run();
});

I have an anim function, and was wondering why I can't call it like this

top.on('click', anim.run);

Solution

  • top.on('click', function () { anim.run(); });
    

    or

    top.on('click', Y.bind(anim.run, anim));