Handlebars

Previous Next

A GUI element normally consists of three parts:

HTML

CSS

JavaScript

The HTML of a GUI element is described in a factory using a technology called handlebars. A compiled handlebar definition is stored in the template member of a factory object and is a function that, when called, returns a string that can be converted into HTML:

<div {{attr "*"}} />

 

It is possible to add extra functionality to the handlebar library. This is done by registering new 'helpers':

Handlebars.registerHelper('<name>', function(items, options) {…});

 

USoft by default delivers a number of those helpers.