Documentation
Basic addon's structure & code
Addons can be very simple and a basic presenter may look as follows:
function AddonSample_create() {
var presenter = function () {};
presenter.run = function(view, model) {
};
return presenter;
}
Each addon is constructed as a function, which returned value (presenter) is passed to the presentation player/editor. This function's name is generated when the addon is created and cannot be changed!
Please be aware that there can be only one addon with a specified name (in this case it's 'sample').
The example addon's structure has presenter.run function, which will be executed when a presentation is fully loaded. At this time, both jQuery library and all third-party libraries will be loaded and ready to use inside the addon. Thanks to this convention, a user doesn't have to put any $(document).ready(...) handlers inside the addon as it is done by modules' runtime enviroment.
To execute a code in the presentation editor, the addon has to implement a different method called createPreview:
function AddonSample_create() {
var presenter = function () {};
presenter.run = function(view, model) {
// Code executed in presentation
};
presenter.createPreview = function(view, model) {
// Code executed in presentation editor
};
return presenter;
}