element.destroy()

Use this method to destroy the Element instance and release all resources, and cannot be mounted again. Calling this method performs the following operations:

  • Removes the Element from the DOM.
  • Removes all event listeners, including internal and your custom listeners.
  • Releases iframe resources.
  • Clears internal state.

Below states the difference between this method and element.unmount():

  • element.unmount(): Unmounts but does not destroy the Element instance, it only removes it from the page. You can call element.mount() again to mount.
  • element.destroy(): Completely destroys the Element instance, releases resources, and cannot be mounted again.

Notes:

  • State after destruction: After the Element is destroyed, no methods can be called anymore.
  • Repeated destruction: Calling element.destroy() repeatedly will not cause an error, but the second call will have no effect.

Method signature

When calling this method, please use the following standard method signature format.

copy
element.destroy()

Parameters

This method takes no input parameters.

Return value

This method does not return any value.