Just read about the AppManager singleton here: <ht...
# compose-desktop
c
Just read about the AppManager singleton here: https://github.com/JetBrains/compose-jb/tree/master/tutorials/Window_API#appmanager It gives an example of using
Copy code
AppManager.setEvents(
    onAppStart = { println("onAppStart") }, // Invoked before the first window is created
    onAppExit = { println("onAppExit") } // Invoked after all windows are closed
)
It doesn't tell you where you would call that though? Since it's invoked BEFORE window is created... I wouldn't put it in my window right? But where do I put it? As a top level function? I'm probably missing something basic here.
x
You can put it anywhere - like directly after the invokcation of 
main
initializeApp()
in this example also has the logic to for
setEvents
on the AppManager
c
@xetra11 ah. A file > new project has this by default
Copy code
fun main() = Window (...
x
well it does not matter if you do
fun main() = Window (...
or
fun main() { Window( ...
so in the latter case you can put logic beforehand
c
@xetra11 YEP. Just found that out. I'm new to this and didn't know that I could just do that. lol. Thanks for your example. it helped