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 | Using a widget inside a fiddle
342
post-template-default,single,single-post,postid-342,single-format-standard,ajax_updown_fade,page_not_loaded,,qode-theme-ver-6.2.1

Using a widget inside a fiddle

02 Jul 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:

define('main',function(require, exports, module) {
    var Engine = require('famous/core/Engine');
    var Modifier = require('famous/core/Modifier');
	// load our widget
    var Widget1 = require('widgetOne');
	
	// use it!
	var widget = new Widget1();
    
	// CODE
	
});


define('widgetOne',function(require, exports, module) {
    var Surface = require('famous/core/Surface');
    
	// CODE

});