const mixinafEfanXtra::EfanLibrary
afEfanXtra::EfanLibrary
Use to manually render a component; an library instance exists for each contributed pod.
As well as the generic renderComponent() method, libraries also have render methods for each individual component. Example, if you had a component:
const mixin CreamPie : EfanComponent {
@InitRender
Void initRender(Str x, Int y) { ... }
}
Then the corresponding library would define:
Obj renderCreamPie(Str x, Int y, |Obj?|? bodyFunc := null) { ... }Each library is automatically injected into your efan components as a field. The field has the same name as the contribution. This allows you to group / namespace components in pods and distribute them as 3rd Party libraries. Example, if CreamPie was in a pod called pies, then if the pies AppModule contained:
using afIoc
using afEfanExtra
class AppModule {
@Contribute { serviceType=EfanLibraries# }
static Void contributeEfanLibs(MappedConfig config) {
config["pies"] = Pod.find("pies")
}
}
Then any application that references the pies pod automatically has the component pies.creamPie, which may be rendered with:
<% pies.renderCreamPie("cream", 7) %>- fitsInitRender
Bool fitsInitRender(Type comType, Type[] paramTypes)Utility method to check if a set of parameters fit the component's @InitRender method.
- name
abstract Str nameThe name of library - given when you contribute a pod to
EfanLibraries.- renderComponent
Str renderComponent(Type comType, Obj?[] initArgs, |Obj?? bodyFunc := null)Renders the given efan component and returns the rendered Str. If the
@InitRendermethod returns anything other thanVoid,nullortrue, rendering is aborted and the value returned.