https://kotlinlang.org logo
Title
c

Colton Idle

01/05/2021, 1:25 PM
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
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

xetra11

01/05/2021, 2:41 PM
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

Colton Idle

01/05/2021, 6:40 PM
@xetra11 ah. A file > new project has this by default
fun main() = Window (...
x

xetra11

01/05/2021, 6:47 PM
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

Colton Idle

01/05/2021, 6:55 PM
@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