on - Methods - Author API

Author API Methods


Set up an event listener for the Author 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 authoring interface.


// Start listening for the 'render:item' event.
authorApp.on('render:item', function (event) {
    console.log('Item rendered.');

// Multiple events can be listened to using chained calls.
    .on('save', function (event) {
        console.log('Save complete.');
    .on('save:error', function (event) {
        console.log('There was an error saving. Please try again.');


  • eventName string

    Name of the event that you want to listen to.

  • eventCallback eventCallback

    Callback function that will be invoked whenever the event is fired.

  • context object

    Execution context that will be used for this when the calback function is invoked.

Return value

Type AuthorApp

Returns the current instance of Author API if successful.

Related articles

  • Author API events
  • The off() method, which allows you to unbind event listeners.
  • The once() method, which allows you to bind event listeners that execute only once.
Was this article helpful?

Did you arrive here by accident? If so, learn more about Learnosity.