Public Method Items API

on()

Sets up an event listener for the Items API. This method binds a callback function that will be invoked whenever the specified eventName is fired.

You would want to use this method so that you can take custom actions in your application when certain defined events occur in the assessment player.

The full list of available event names are listed on the Items API Events page.

Examples

function myEventHandler() {
    console.log('The callback which executes when an event is fired.');
}

// Sets up a recurring event listener for the 'focused' event.
itemsApp.on('focused', myEventHandler);

// Listen to all assessment player events
itemsApp.on('*', myEventHandler);

Arguments

  • eventName string
    Name of the event that you want to listen to.
  • eventCallback function
    Callback function that will be triggered whenever the event is fired.
  • context object
    Execution context that will be used for this when the callback function is fired.

Return value

None (undefined).

Related articles

Was this article helpful?