This documentation is currently being moved to our new documentation site.

Please view or edit the documentation there, instead.

If you're looking for Fluid Project coordination, design, communication, etc, try the Fluid Project Wiki.

Use events declaratively

Wherever possible, use event boiling instead of firing events manually using the fire() function. If a component needs to know when something happens in one of its subcomponent, declare the parent event as a listener for the child's event:

/* The subcomponent defines an event that will fire at some point */
fluid.defaults("my.component.kid", {
    ...
    events: {
        childEvent: null
    }
});

/* The root component declares an event that becomes a listener for the subcomponent's event */
fluid.defaults("my.component", {
    ...
    events: {
        myEvent: null
    },
    components: {
        child: {
            type: "my.component.kid"
            listeners: {
                childEvent: "{parent}.myEvent"
            }
        }
    }
});