Widget

Implement Spec

Widget

A HTML widget, that is a “div” containing HTML inside. It also consist of corresponding javascript to handle the interaction with the widget. A Widget has its own looks and feel (Template), and its own interaction (action). Widget can communicate with other widgets through widgetApi. It can also communicate with the system (the system contains the widget) via widgetApi. A Context feeding into Template/Action becomes a Widget.

Template

The handlebar template that use Context as input, and generate the HTML as the content of the Widget. The Template is the presentation of the Widget, not the data of the Widget.

Action

A set of javascript functions that implement the interaction of the widget. There are 3 must-implement javascript functions that used by the system, to load, initial and destroy the widget. To associate the Action with specific Template, just register them under the same name. Follow the template/action upload format will associate the template and action to the specified name. See upload template/action.

Context

A javascript object that serve as the input to Template. Context contains the widget specific information.

Schema

The schema of the simple editor of the Widget. The schema can change the layout of simple editor. For example, if we declare an object is type of “photo” in the schema, then that object in simple editor will be presented as a photo selector/uploader logic, instead of just a text input.