Friday, 15 August 2014

surface - How can I overwrite the .on() Method in Famo.us -



surface - How can I overwrite the .on() Method in Famo.us -

after first click want alter .on() method.

mysurface.on("touchstart",function(){ dosomething(); })

and after first click want alter illustration to:

mysurface.on("touchstart",function(){ dosomethingdifferent(); })

how can overwrite .on method?

overwriting .on() method not needed in case here.

here 1 way handle utilize case.

class="lang-js prettyprint-override"> var dosomethingelse = function(event) { console.log('dosomethingelse', event); console.log('mysurface', this); }; var dosomething = function(event) { console.log('dosomething', event); console.log('mysurface', this); func = dosomethingelse; }; var func = dosomething; mysurface.on("touchstart",function(event){ func.call(this, event); });

famo.us surface

No comments:

Post a Comment