once - Methods - Evaluation Options Editor API

Evaluation Options Editor API Methods

once()

Registers an event listener that runs only the next time the specified event fires.

You would want to use this method to run a callback function the next time the specified event fires, for example, to react to the first change an author makes. The listener is removed after it runs.

Examples

// Log only the first change
editor.once('change', function (options) {
    console.log('options have changed for the first time', options);
});

Arguments

  • event string

    The name of the event to listen for.

    Possible values

    • "change"
    • "reset"
  • callback function

    The function to run when the event fires.

Return value

None (undefined).

Was this article helpful?

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