Removing fxComponent from Skin
Issue
Flex 4 Skins expose two different ways to refer back to the skins owning component:
- fxComponent: an 'Object' typed property available to all skins that refers to its owning component.
- [[HostComponent]]: a piece of metadata that a skin can declare to automatically generate a strongly typed property referring back to its owning component.
fxComponent exists on skin to avoid requiring skin developers/designers to declare a script/metadata block with the [HostComponent] metadata.
Supporting fxComponent comes with a cost, however. When developers want to bind to properties in the host component, they can choose to do it either through fxComponent, or hostComponent. as an untyped variable, bidning to fxComponent triggers an expensive runtime lookup using the describeType introspection API. While untyped bindings are important and necessary in some cases, in this case we have a functional and reasonable alternative to generate strongly typed bindings.
Simultaneously, we have as a general rule moved away from heavy use of bindings in our skins. Where data is pushed into skins, we have generally moved to a 'push' model, where the skin provides a part that the compoennt can push values into directly. Very few of our skins make use of either the fxCompoent or hostComponent properties.
Proposal
Remove the untyped fxComponent reference from Skin. require all skins that want a reference to their compoennt to declare [HostComponent] metadata and use the hostComponent property. For skins that want untyped access to their compoennt, they can declare the type in the [HostComponent] metadata to be Object.
| You must be logged in to comment. |
|