off - Methods - Grading API

Grading API Methods

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.

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

Examples

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

// Removes event listeners for the 'attachitem:start' event.
gradingApp.off('attachitem:start', attachItemStartHandler);

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.

Return value

None (undefined).

Related articles

  • List of all Grading API Events
  • The on() method, the method used to add custom event listeners to the assessment events.
  • The once() method, the method used to add custom event listeners to the assessment events that will only execute once.
Was this article helpful?

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