A widget represents a user interface element. Mostly this will be elements added to the sidebar.
Each widget is represented by a folder inside the swfm document tree. This folder has following structure:
Here is a very simple example:
(function() {
//create a new widget
var exampleWidget = {
//initialize the widget
init: function() {
/*
* ... your code here ..
*/
}
};
//register the new widget
SWFM.Widget.register('example', exampleWidget);
})();
The name of the directory of the widget and the string (first parameter) in SWFM.Widget.register have to be identical. This is also the name to load the widget (see example config).