Is there a way on desktop to catch AppClose event

I’m trying to call some function when my app closes. Actually I’m using DEACTIVATE but that event fires also when window is minimized.

I would like to catch app close event. Is there a way to fo this on desktop target?

I found it:

Lib.current.stage.onQuit = function(){trace(‘Quiting!’)};



Does this work on other targets too? I know Flash (not OpenFL specifically) does not have an easy way to detect browser-window closes.