No, the OnDestroy event does not trigger when the browser or browser tab is closed. The event is only called when navigating to another Screen within a Reactive (or Mobile) application.
From the docs:
The On Destroy event handler executes when the Screen or Block is going to be destroyed.
In Screens, this event happens when the transition to the new Screen ends.
In Blocks, this event happens before the Block is removed from the DOM.
For Juan Carlos' original use-case, the best solution is to:
- Store the time of last activity associated with each user 'session'.
This could be updated with every user operation in the app, or only for some operations. - Monitor inactive sessions using a Timer or other background process, and clean these up after a set time (ex. 8h of inactivity).