How to Create a Fluid Component

Documentation for a historical release of Infusion: 1.3
Please view the Infusion Documentation site for the latest documentation.
If you're looking for Fluid Project coordination, design, communication, etc, try the Fluid Project Wiki.

How to Create a Fluid Component

This tutorial is based on Infusion v1.1, and is, hence, a bit out of date. It will be deprecated soon. For more up-to-date information, try Creating a Component.






To summarize, the following code is a .

/* Insert license here */ /*global jQuery*/ /*global fluid_1_1*/ fluid_1_1 = fluid_1_1 || {}; //use current released version number (function($, fluid) { var privateFunc = function() { // some private function }; //see http://wiki.fluidproject.org/display/fluid/The+creator+function //start of creator function nameSpace.componentName = function(container, options) { var that = fluid.initView("nameSpace.componentName ", container, options); that.publicFunc = function() { // some public function }; return that; }; //end of creator function //start of defaults fluid.defaults("componentName", { //default options can be selectors, styles, strings, or events //also can create options based on subcomponents using subComponentName as the optionName //finally, custom options are also possible //see http://wiki.fluidproject.org/display/fluid/fluid.defaults option1Name: { key: value }, option2Name: { key1: value1, key2: value2 } }); // end of defaults })(jQuery, fluid_1_1);