Skip to Content
avatar image
Former Member

When onExit() will be executed?

Hi,

Documentation tells that onExit() calls by framework when view is destroyed.

Does any one know whether Controller's onExit() will be called either on page "refresh" OR closing browser tab.?

Thanks,

Srinath

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Nov 29, 2016 at 10:28 AM

    Ok.

    Is there any way to distinguish between "refresh" and "tab close" of a Browser by using UI5 ?

    Thanks,

    Srinath

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 28, 2016 at 08:17 AM

    On the one hand you can configure to destroy navigational views at routing by configuring the clearTarget property.

    Or in case you tear down an app, onExit will be executed as well. Examples could be the tear down of a Fiori app or the iTeardownMyUIComponent() function used at OPA5 testing.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 29, 2016 at 06:45 AM

    Hi Ulrich,

    Thank you for response.

    In our app we are not using Routing and it is a Customized UI5 app.

    Challenge here is, in our app we are calling 'DestroySession' OData call to kill user session inside "beforeunload" method. 'DestroySession' should execute only Closing of the browser, not on Browser refresh. Unfortunately, "beforeunload" is being called on browser "refresh" also.

    I tried to distinguish between "refresh" and "tab close", but no luck.

    I tried modifying 'beforeunload' so as to prompt user with options "Leave/Stay", but am unable to get the event on which button user has clicked (Leave/Stay).

    So, thought of shifting 'Destroying Session' OData call to onExit(). Trying to see when onExit() will be executed, either on 'refresh of the page' OR 'tab close'.

    Thanks,

    Srinath

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 29, 2016 at 10:29 AM

    Hi- We can find this action on two places.

    1. While destroying running components, this call back will execute.
    2. While getting out from Launchpad App, onExit will execute
    Add comment
    10|10000 characters needed characters exceeded