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.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

This functionality is Sneak Peek status. This means that the APIs may change. We welcome your feedback, ideas, and code, but please use caution if you use this new functionality.

New in v1.4

Sometimes, you may need to make sure that something in a parent component is fully in place before a subcomponent is instantiated: perhaps data needs to be fetched from an external source before a subcomponent can work with it, or a template needs to be rendered before the subcomponent can bind events to elements.

The createOnEvent allows you to specify an event to trigger the creation of a subcomponent: If this option is specified, the IoC system will wait until the parent component fires the named event before creating the subcomponent.

Using createOnEvent in the parent's defaults

createOnEvent can be specified as part of a subcomponent's definition in the parent's components block, as shown in the example below:

fluid.defaults("fluid.uiOptions.preview", {
    ...
    events: {
        onReady: null,
        ...
    },
    components: {
        enhancer: {
            type: "fluid.uiEnhancer",
            createOnEvent: "onReady",
            options: {
                ...
            }
        ...
    }
};

In this example, a component called fluid.uiOptions.preview is declaring a subcomponent called enhancer. The enhancer subcomponent must wait until the parent component has been fully initialized before it is created, so createOnEvent is used to specify the "onReady" event. The IoC framework will wait until the parent component (fluid.uiOptions.preview) fires its onReady event before instantiating the enhancer subcomponent.

  • No labels