HeinrichApfelmus / threepenny-gui

GUI framework that uses the web browser as a display.
https://heinrichapfelmus.github.io/threepenny-gui/
Other
439 stars 77 forks source link

ending application - cleanup operations #114

Open andrewufrank opened 9 years ago

andrewufrank commented 9 years ago

i cannot find a way to cleanly stop the gui with a button and then execute cleanup actions. if a have a button to produce an error to force the server to stop . it restarts automatically and the code placed after starting the web server is never reached. i have a setup function for all gui layout and operations. it returns an action which must run after closing the application.

  1. how can the startGUI return this closing action?
  2. what is the proper way to close the gui with a button?
  3. where must the closing action be placed to run after closing the application (e.g. when closing the window or button click)

thank you!

HeinrichApfelmus commented 9 years ago

Right now, there is a disconnect event that fires when the user closes the browser window. You can use this to clean up.

If you want to close the window from the server side, you're currently out of luck, as this hasn't been implemented yet.

ulysses4ever commented 3 years ago

@HeinrichApfelmus is it still not possible to initiate closing the browser window from the server? Is there a way to shut down the server at least? (I tried liftIOLater exitSuccess but it seems to restart server, not shutdown it.)