In the Infusion IoC system, a component can declare its subcomponents through the components property of the defaults, using fluid.defaults:

fluid.defaults("my.component.name", {
    ...
    components: {
        subcomponent1: <subcomponent declaration>,
        subcomponent2: <subcomponent declaration>,
        subcomponent3: <subcomponent declaration>,
    },
    ....
});

Basic Subcomponent Declaration

The subcomponent declaration has the following basic form:

fluid.defaults("my.component.name", {
    ...
    components: {
        subcomponent1: {
            type: "type.name"
            options: {...},
        }
    },
    ....
});

In this form of the declaration, the properties are:

Property

Description

Example

type

This is a string representing the type of subcomponent to use. It will generally be the string used as the demandingName argument to fluid.demands, but it could also be the actual function name of the subcomponent. These variations will be described further below.

subcomponent1: {
    type: "fluid.mySubcomponent"
}

options (Optional)

These are options to be passed to the subcomponent as "user options." Note that these are not the default options for the subcomponent. Any defaults should be declared in a separate fluid.defaults call.

subcomponent1: {
    type: "fluid.mySubcomponent",
    options: {
        myOptions: "{name}.options.someOption",
        ...
    }
}

createOnEvent (Optional)

Specifies the event object that will trigger the creation of the subcomponent when it is required for the subcomponent to be created at the time (later) other than during the call to fluid.initDependents of the parent component.

subcomponent1: {
    type: "fluid.mySubcomponent",
    createOnEvent: "someEvent"
}

priority (Optional)

Specifies the order priority of the creation of the particular subcomponent. During the execution of fluid.initDependents the framework will sort the collection of subcomponents based on the priority specified.

subcomponent1: {
    type: "fluid.mySubcomponent",
    priority: "first"
}

Subcomponent Types

... to come ...