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 | Events
16
archive,category,category-events,category-16,ajax_updown_fade,page_not_loaded,,qode-theme-ver-6.2.1

Events

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;"]...

Application View start Best Practice

After some discussion with Nicholas Reed, I wanted to share a best practice method of starting a Famo.us application. Here is Example Code Nick had an issue that I thought would benefit from this method. Steps: Add your app view to the main context, not all your views. Have the...

Event System

This article is by Mark Marijnissen  [from a post on Famo.us Google Group]   EventEmitter.js EventEmitter is the source of all events. emit(type,event) (a.k.a. trigger): Emits an event to everybody listening (= invoke callbacks) addListener(type,callback) (a.k.a on): Listen to an event (= add callback) Chaining Imagine the following: C (an App-Router) is listening to B (a Menu-View) is listening to A (a Menu-Item-Surface). So a click event is emitted...

SwipeSync for Famo.us

The SwipeSync component allows you to have simple swiping support in four directions. Personally I use these for app navigation. Swiping east (left to right) means go back to the parent page (eg if the current location is home -> categories -> pie: go to categories) Swiping west means...

Surface.on(“tap”, ….) – A convenience hack

FastClick was not working for me. Touchend is insufficient: If I scroll and my finger happens to be on a link, I don't want to click the link. Enter the TapEvent hack. It hijacks the Surface.on function to emit a "tap" event when conditions are...

Widget with Surface Events Piped

There are times when you want to create a View that has a Surface attached.  The issue is there is a need for the Surface to broadcast it's own events to the view. Here is the trick to making sure you pipe from to the view: surface.pipe(view._eventOutput); The following shows...

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.