Expansion of Default Component Options

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.

Expansion of Default Component Options

Expanders

Infusion component option defaults now go through a process called "expansion" during the component creation process. An expander is essentially a function that is called at component-creation time to create the value of the default. This can be useful when static definition of a default option is not possible.

Expanders are specified using the keyword "expander:" in the component defaults:

fluid.defaults("component.name", { optionName: { expander: { ... } } });

The format of an expander object varies slightly depending on the particular expander type, but in general, the object will have some of the following properties:

Name

Description

Name

Description

type

this is the string name of the expander. Currently, several expanders are provided by the framework, and are described below.

func

Some expanders call user-provided function. In these cases, this property is the string name of the user-provided function.

args

This is an array of arguments to be passed to the user-provided function

href

 

options

 

resourceSpecCollector

 

fetchKey

 

Supported Expanders

Two expanders are currently provided by the framework, and component creators can specify these expanders in their default options:

fluid.deferredCall

The fluid.deferredCall expander will call the specified function, passing it the arguments provided. The return value will be assigned to the default option. For example:

fluid.deferredInvokeCall

The fluid.deferredInvokeCall expander is essentially the same as fluid.deferredCall, but it will actually perform resolution of the client's demanded name. That is, it will look up the function name in the registered demands to determine what function will actually be called. For example: