Constructor
new module:caplin/presenter/PresenterRenderer(viewModel, templateId)
Constructs a new instance of
PresenterRenderer
.
Parameters:
Name | Type | Description |
---|---|---|
viewModel |
Object | A module:br/presenter/PresentationModel or an other valid presenter node. |
templateId |
String | ID of the template that the presentationModel will bound to. |
Methods
-
addComponentLifecycleListener(listener)
-
Add a listener that will be informed of component life-cycle events. Note that this will only trigger `onOpen` and `onClose` events. This is for compatability with the rest of the Presenter framework that is expecting presenter components.
Parameters:
Name Type Description listener
Object -
bindView()
-
Binds the view to the model if it hasn't already been bound
-
destroy()
-
Destroys the bound element.
-
getElement() → {DOMElement}
-
On first call it will bind the view model to the template and return a DOM node, that can then be used to insert into the DOM. On subsequent calls it will returned the previously created DOM node.
Returns:
- Type
- DOMElement
-
getPresentationModel() → {Object}
-
Return the view model used in this renderer.
Returns:
- Type
- Object
-
getTemplateId() → {String}
-
Return the template ID used in this renderer.
Returns:
- Type
- String
-
isViewAttached() → {Boolean}
-
Returns true if the view has been attached.
Returns:
- Type
- Boolean
-
isViewBound() → {Boolean}
-
Returns true if the view has been bound.
Returns:
- Type
- Boolean
-
removeComponentLifecycleListener(listener)
-
Removes a component life-cycle event listener.
Parameters:
Name Type Description listener
Object -
viewIsOpened()
-
Components must call this method from their `onOpen` callback. This signals all interested parties that the view has been attached to the DOM and is now visible.