Exit Event or something notifying when App closes

Is there any Event or any way that I could capture when the App is closing or exiting? I see there is an App_Launched Event, I was hoping to find something similar on Exit so I could save and write out user data, such as log-out time or whatever. Just wondering if this might be possible with Advanced Custom Event if anyone can help.

@JOHN_WORSHAM

Hi!

On app level there isn’t such an event. but you could use the “page will unmount” event for a similar effect, as it will run right before the app closes.

So this would occur on the initial page i assume?

@JOHN_WORSHAM

As far as I remember, it should fire from any pages, as they will all unmount.

Right but if the First Initial page unmounts then wouldnt that be the app exiting? Or does a page unmount any time you just navigate away from it? Im just trying to clarify what situation occurs that causes Unmount to occur
And whether its possible that the initial page unmount but other pages still remain mounted.?

@JOHN_WORSHAM

Ah, I see what you mean! The “will unmount” should only occur when the app exits, and it will then occur for all pages. However I wouldn’t trust the pages to unmount in any specific order.

1 Like

Thank you, that is what I needed to know. And very good to know!

Is there an event like “will unmount” for web apps that would capture a user closing the browser / tab? Or am I asking for something impossible?

:thinking: I think the way this is done on web is when the mouse kind of goes “away” from the window of the web app, an event is triggered. As such, it’s a different event than the “will unmount” event (unless you tried that and it happened to work) and I don’t think we have that available as of now, but you could add it onto the list here.

2 Likes

Hey @JOHN_WORSHAM, are you able to use the Page will unmount event? I’ve tried to use it but to no avail (I keep getting this error instead: ERROR fron NODERED: Unknown node id: cc5a1128.1fe52). Also what triggers it? Using Preview app, the error I get only appears if go back to the Apps list, however closing the Preview app doesn’t seem to trigger anything.

Is there any change in this topic? Some way to do it yet?

What I want to do is before user closes the app or switch to another app, send data (PUT) to Firebase. I think that uploading the data does not consume resources on Firebase (free account). If anyone can confirm this?

Thanks