Connect with:
About Me
Alessandro Annini
I'm a freelance developer currently working at Leaff.it/ I really love famo.us framework and its amazing potential and if you're like me, and you want the web to win, please share some snippet of code for the community and grow faster with us
Categories
Meta
Famo.us Code | jsfiddle
27
archive,tag,tag-jsfiddle,tag-27,ajax_updown_fade,page_not_loaded,,qode-theme-ver-6.2.1

jsfiddle Tag

Cube Globe (Clobe)

A cube component with open street map data on it. [wp-js-fiddle url="http://jsfiddle.net/trusktr/9etv5L3y/" style="width:100%;height:400px;border:solid #4173A0 1px;"]...

Be careful when using .on(‘keydown’, callback);
In the IRC it has arisen a few times about people with issues with the surface.on() event. I am just writing a quick post to let you know what is happening, and how to avoid it (albeit with rather messy code!). What happens is people are using the .on('keydown', callback); to trigger an event once, but that isn't how it works. What happens is the engine checks if there is a keydown trigger every tick, and then executes the callback if there is, which can be rather messy and cause event spam. To avoid this, you simply wrap the method of the callback in a boolean controller, to avoid the engine spamming the callback method. My code is messy, but you should be able to see the difference in the two fiddles below.