destroy

This method is invoked when the component is to be removed from the DOM tree. Use it for the cleanup and to release any memory that the component is using.

Available for

Model-driven apps and canvas apps (experimental preview)

Syntax

destroy()

Example

MyControl.prototype.destroy = function () {
 this.button.removeEventListener("click", this.onButtonClick);
};

Control
PowerApps component framework API reference
PowerApps component framework overview