Template interface

A JavaScript object implementing the Template interface represents a template for generating textual data, such as HTML for displaying to the user.

See Templates for how to use Template objects.


Obtain a Template object using the template() function in Plugin.


property kind

The kind of output this will produce, for example, "html". The value may be null.

This property can be used to set the kind property of a HTTP Response object. This is done automatically when using the render() function on an Exchange object.

function render(view)

Render the template, returning a String.

view is a JavaScript Object used as a dictionary to provide parameters for the template rendering.

If you’re generating HTML to include in another template, prefer using deferredRender() and the render() template function.

function deferredRender(view)

Return a Deferred object which can be used with the render() template function. At the point the render() template function is rendered, this template will be rendered with the given view.

See Deferred rendering for how to use deferredRender().