Hello. Just starting to learn Haxe and Heaps.
Where would I place code that I want to execute on exit? There is no callback in hxd.App that I can see. Can I hook the window closing in some way maybe?
Hello. Just starting to learn Haxe and Heaps.
Where would I place code that I want to execute on exit? There is no callback in hxd.App that I can see. Can I hook the window closing in some way maybe?
If not handled from Heaps maybe you can try at target level? For JS you can look at beforeunload, while for HL/C atexit might work.
I have no idea about HL/JIT
By the way, how do I even exit the application?
Addition:
Sys.exit(0);
…seems to work OK.
Addition 2:
Ah, found it:
hxd.System.exit();
Got it. You rebind the onClose method on the window instance. Like so:
hxd.Window.getInstance().onClose = this.onClose;
This does not catch the Sys.exit approach though. But since that’s done manually anyway, there’s no need to trap it.