Tab closing event

Since 24.1.0 there is a special event used to notify the server when the browser window or tab is closed(https://vaadin.com/blog/vaadin-flow-24.1-drastically-reduces-memory-usage) .
I want to add listener for tab closing event, but don’t know how to do this.

I’m using vaadin 24.2.0 now.

You can check the unload listener here: SuperFields - Vaadin Add-on Directory

Although unload is sort of deprecated… 24.1+ uses page hide event actually.

Yeah, I want somehow to use it to run my listener in this event. Is there is some way to do this?

Since 24.1.0 there is a special event used to notify
Perhaps there is misconception here. The mechanism in Vaadin 24.1.0 is automatic. You do not need to listen to this event. Vaadin will close UI’s by listening pagehide and Beacon API. There is no API in Vaadin 24.1.0 added, so it is always on.

If you want to do something specific, you should ask about what you’re trying to achieve instead of the mechanism you were thinking of using

In other words, what would you do with that listener, if you had one?

It’s okay now. I have used detach listener for my needs, it didn’t work for tab closing before v24.

Sounds like the correct way to go. It works in older versions, too, it just takes some time for the session to timeout.