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 | Components
4
archive,paged,category,category-components,category-4,paged-2,category-paged-2,ajax_updown_fade,page_not_loaded,,qode-theme-ver-6.2.1

Components

How to wrap a RenderController up in a RenderNode

RenderNodes are the gods of StateModifiers. If you want to make a StateModifier for any form of renderable(EG A RenderController, A View, A Layout or even ANOTHER RenderNode), wrap it up in a RenderNode to make it constrain all of it's children to it's state.   See...

Using a widget inside a fiddle
Thanks to Talves we discovered how simply is to use a widget/component right inside our fiddle:
  1. copy the hole widget code after your code;
  2. give it a name different from 'main';
  3. call it with a simple require, like this:
Show/Hide nodes with visibility modifier
What if you simply want to show/hide a renderable? ScrollViews have a clever algorithm to determine which surfaces to render.The RenderController has a clever algorithm that allows for renderables to transition in and out of view..... For all other uses - no scrolling or transitioning - use this:
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.
Autosizing Surface / Tabs
You can now use a sequential layout with this extended surfaces set to size: [true, true] and the layout will respect the content size of the surfaces.