-
Notifications
You must be signed in to change notification settings - Fork 9
Bootnode
The bootnode is a simple way to load necessary javascript on the fly. If you have a feature not really used or available across all the site, you may like not to specify associated javascript in the head. So bootnode allows you to define it in the html markup using data attributes.
In the core building using tetra.extend({conf:{}})
(cf. Presentation part), you have to set the enableBootnode
parameter in the conf
to true. Il will activate this feature for all applications.
Bootnode definition must be set in the container element of the application interface. We need to have 3 parameters :
-
class="bootnode"
: the bootnode className allows the core to find which element is reactive to bootnode actions. -
data-view="appName/viewName"
: the path to the view object associated to the html markup. -
data-comp="compName"
: replace thedata-view
attribute if you want to load a packed javascript with a custom namecompName
. -
data-event="click"
: the event that will be handled to launch js retrieving and action call. This attribute supportsclick
,mouseover
andfocus
event type.
<div class="bootnode" data-view="likeApp/likeButton" data-event="click">
...
</div>
or
<div class="bootnode" data-comp="likePackage" data-event="click">
...
</div>
Controller and model objects will be retrieved according to the use
parameter of the view and controllers. The core build a chain of dependencies, download each js file and initialize them in the following order: models then controllers then view. After all these steps are completed, the event action is called.