destroy - Methods - Evaluation Options Editor API

Evaluation Options Editor API Methods

destroy()

Permanently tears down the editor instance by removing it from the DOM and removing all of its registered event listeners.

You would want to use this method so that you can clean up the editor when you no longer need it, for example, when you remove the component from your application.

Note Unlike the detach() method, which leaves the instance live so you can attach it again, destroy() is terminal and the instance is not reusable after you call it. The instance still accepts calls such as attach() and setOptions(), but it no longer notifies your event listeners. To continue, create a new instance with the createEditor() method.

Examples

// Tear down the editor when you no longer need it
await editor.destroy();

Arguments

None.

Return value

Type Promise

Resolves when the editor is destroyed.

Was this article helpful?

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