en | fr

The View class


This class is a sort of black-box managing views inside the application. It relies on both Handlebars (to generate the HTML from .hbs files) and jQuery to inject the results inside the DOM.


render

Fills the current page with the result of the template compilation.

Parameters

Returns null


append

Appends the result of the template compilation to the current page.

The process is stopped if the current action doesn’t match with the requested template. Thus, if an action takes too long to load data and the user has clicked on a different one, they won’t have elements of the former shown.

Parameters

Returns null


compile

Compiles a template through Handlebars. If the template’s already been compiled, we just read it from the cache.

Parameters

Returns Function


registerPartial

Facility to define partials as Handlebars helpers. It compiles the given partial, render it and wrap inside a Handlebars safe string.

Parameters

Returns null