Skip to content
Corwynt edited this page Aug 27, 2018 · 2 revisions

To show elements inside the UI, a View has to be created. A view consists of HTML and Javascript code, which runs in the Browser. Since Midori is used as the default Browser on BeagleBoom, the ECMA 6 standard is not fully supported.

Files

To add a new view two files have to be added to the system. Assuming the views name is test:

/static/controller/test.js
The file has to contain a function which is called the same as the view name with a preceding "$" sign.
function $view(){
//content
}
/static/templates/view.html
The html and css for the view. Handlebars can be used for conditional rendering. The data provided in the `api.display` call can be accessed inside the template.

JS File

The function is called as soon as the UI is loaded. It should return a function, which is called by the system when the view is loaded through the api.display call. This function then returns an object with the following keys (all optional).

start(data)
Is called with the provided data, after the views html has been rendered.
stop()
Is called when another view is about to be loaded.
onEvent(event,data)
Is called when an event is send to the view with `api.sendView`.
Clone this wiki locally