Public Method Items API

off()

Removes a previously-bound callback function for an event.

You would want to use this method so that you can unbind an event listener if you no longer need to execute the callback function, for example.

When called with no arguments, all event listeners are removed.

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

Examples

// Removes event listeners for the 'focused' event.
itemsApp.off('focused');

// Removes event listener for the specified callback that was previously bound
function myFocusedCallback() {
    console.log('The callback that is executed when "focused" has been fired');
}
itemsApp.off('focused', myFocusedCallback, this);

// Removes event listeners for all events.
itemsApp.off();

Arguments

  • eventName string
    Name of the event that you want to stop listening to.
  • eventCallback callback
    If no callback is provided, all event handlers for the eventName will be removed.
  • context object
    If no context is provided, all event bindings for the eventName and eventCallback combination will be removed.

Return value

None (undefined).

Related articles

Was this article helpful?