Public Method Author API

off()

Removes a previously bound callback function (using the on method) for an event.

You would want to use this method so that you can stop listening to particular events and re-bind new event listeners with new logic, for example. This method would be useful in cases where your are using a single page application and use a custom interface.

When called with an empty string, the callbacks for all events are removed.

Examples

// Stop listening for the 'widgetedit:widget:ready' event.
authorApp.off('widgetedit:widget:ready');

// Multiple events can be unbound using chained calls.
authorApp
    .off('widgetedit:widget:changed')
    .off('widgetedit:preview:changed');

// Removes all event listeners. Note the empty string must be passed as an argument.
authorApp.off('');

Arguments

  • eventName string
    Name of the event that you want to stop listening to.

Return value

AuthorApp

Returns the current instance of Author API if successful.

Related articles

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