Value Destroy

aura:valueDestroy

Indicates that a component is destroyed.

This event is fired when a component is destroyed. Handle this event if you need to do custom cleanup when a component is destroyed.

1<aura:handler name="destroy" value="{!this}" action="{!c.handleDestroy}" />

This client-side controller handles the aura:valueDestroy event.

1({
2  handleDestroy: function (component, event, helper) {
3    var val = event.getParam("value");
4    // Do something else here
5  },
6});

Let’s say that you are viewing a component in the Salesforce app. The aura:valueDestroy event is triggered when you tap on a different menu item on the Salesforce mobile navigation menu, and your component is destroyed. In this example, the value parameter in the event returns the component that’s being destroyed.

Attributes 

NameDescriptionTypeDefaultRequired
valueThe component that is destroyed.object