M_Follower
M_Follower

Reputation: 111

Invoke onExit() manually in SAPUI5

Is there is a way to invoke onExit() Life cycle hook manually?

Upvotes: 0

Views: 4122

Answers (1)

Tim Gerlach
Tim Gerlach

Reputation: 3390

If you´re talking about the onExit function of your controller you can! However, you should consider the View Lifecycle. According to this Lifecycle the framework will automatically call the onExit hook for you:

onExit(): Called when the view is destroyed; used to free resources and finalize activities

Source: SAPUI5 Documentation

Since it is a function which belongs to your controller you are able to call it manually by this.onExit() (in your controller).

However, this shouldn´t be necessary. To act according to the lifecycle you can call .destroy() of your view which destroys the view, the controller and all associated children.

destroy(): Cleans up the resources associated with this element and all its children.

Source: SAPUI5 Documentation

Upvotes: 3

Related Questions