Wiki Markup |
{div:class= Div |
---|
| }
{ |
:=}** [ ]{span} {span:class=}[ overview|Tutorial - Getting started with Infusion]{span} {span:class=}** [ Components]{span}
{div} |
Wiki Markup |
---|
{div:class=floatRight}
{panel:title= On This Page| borderStyle=solid| borderColor=#ccc| bgColor=#fff}
{toc:minLevel=2|maxLevel=5}
{panel}
{div} |
Wiki Markup |
---|
{div:class=floatRight}
{panel:title= See Also| borderStyle=solid| borderColor=#ccc| bgColor=#fff}
[Component Grades]
[fluid.defaults]
[Options Merging]
[Inversion of Control (IoC)]
[Component Lifecycle and autoInit]
{panel}
{div} |
Div |
---|
|
Panel |
---|
borderColor | #ccc |
---|
bgColor | #fff |
---|
title | On This Page |
---|
borderStyle | solid |
---|
| |
|
Regardless of which grade of component you use, the basic structure will be the same. We'll use the simplest grade, a little component, to illustrate what this structure is. In future pages explaining other grades, you'll see the same principles.
...
- directly: You write the function yourself
- using IoC - Inversion of Control (IoC): The framework will create the function according to your specifications
...
Automatic creator function generation
The IoC - Inversion of Control (IoC) system can automatically generate a component creator function for you. This is accomplished by added a special grade to the gradeNames
property: "autoInit":
...
Code Block |
---|
|
fluid.defaults("tutorials.currencyConverterAuto", {
gradeNames: ["fluid.littleComponent", "autoInit"],
exchangeRate: 1.035,
finalInitFunction: "tutorials.currencyConverterAuto.finalInit"
});
// The final init function
tutorials.currencyConverterAuto.finalInit = function (that) {
that.convert = function (amount) {
return amount * that.options.exchangeRate;
}
};
|
Wiki Markup |
{div:class= Div |
---|
| }
{ |
:=}** [ ]{span} {span:class=}[ overview|Tutorial - Getting started with Infusion]{span} {span:class=}** [ ]{span}
{div} |