Presenter

Minimal presenter code:

function AddonDemo_create(){

    var presenter = function(){}

    presenter.run = function(view, model){
    }

    return presenter;
}

Required functions

Function Description
run(view, model) Initialize the addon when a module is loaded.
  • view - DOM reference with the addon's view code loaded
  • model - an array with property values

Editor functions

Function Description
createPreview(view, model) Used by the presentation editor to create preview in the editor's mode.
  • view - DOM reference with addon's view code loaded
  • model - Array with property values

Optional functions

Function Description
executeCommand(commandName, params) Execute command with given *name* and *params*
setShowErrorsMode() Addon should mark all errors and disable all interaction
setWorkMode() Return to normal mode.
reset() Return module to initial state
getErrorCount() Return current number of errors
getMaxScore() Get maximum score for this module
getScore() Get current score
getState() Return state (as String) which should be preserved while switching between pages.
setState(state) Return to previously saved state.

Player Controller

If you want to access player functions from the addon, you have to implement the following function:

    presenter.setPlayerController = function(controller){
    }

The object controller is the PlayerServices type.