...
Section |
---|
Column |
---|
Code Block |
---|
|
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. |
|
Using createOnEvent
in a demands block
...
fluid.defaults("fluid.uiOptions.preview", {
...
events: {
onReady: null,
...
},
components: {
enhancer: {
type: "fluid.uiEnhancer",
}
}
};
fluid.demands("enhancer", "fluid.uiOptions.preview", {
createOnEvent: "onReady",
options: {
...
}
});