Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

New in v1.4

Include Page
sneak peek warning
sneak peek warning

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.

...

Section
Column
Code Block
javascript
javascript

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

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.