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

fluid.initLittleComponent

fluid.initLittleComponent(name, options)

A "little component" is a Fluid module with a collection of merged options; options that are provided by both the user and the component's defaults. It is a convenience method for creating small objects that have options but don't require full View-like features such as the DOM Binder or events.

fluid.initLittleComponent = function (name, options);

File name: Fluid.js

Parameters

name (Object) The component name
options (Object) The component options

Return value

Object A module with merged options


How to create a little component

We want to create an HTML5 Uploader little component containing sub-components to locally add files to the file queue and to remotely send files to a server. The HTML5 little component can be instantiated in two different ways. See the following examples below:

A direct call to the framework API:

var that = fluid.initLittleComponent("fluid.uploader.html5Strategy", {
    components: {
        local: {
        }
        remote: {
        }
    }
});

Indirect IoC-driven approach:

fluid.defaults("fluid.uploader.html5Strategy", {
    gradeNames: ["fluid.littleComponent", "autoInit"],
    components: {
        local: {
        }
        remote: {
        }
    }
});

A component grade is required by setting the gradeNames property to "fluid.littleComponent". The "autoInit" grade is included so that the component's actual creator function doesn't need to be written at all.