I don't understand how to write application with it.
SchmidtDawid opened this issue · comments
Hi i completely don't understand how to use this in bigger aplication. I created a project, and everything works fine even with vue app but...
I want to create bigger app with it and wondering how to use it.
For example i tried to create new function with astrilectron basic init to use it like:
func main() {
a, w := InitAstrilection()
w.OnMessage(func(m *astilectron.EventMessage) interface{} {
w.OpenDevTools()
return nil
})
a.Wait()
}
It doesn't work because app is closing immediately, but if i move a.Wait() on the and of InitAstrilection() function it never ends.
What if i need hundreds OnMessage reactions? Wow to sort it out to not have to keep everything i one file?
Is there any documentation what workers are, and how to manage them?
This is weird that the code you shared make the app close immediatly. Normally you should
- create astilectron
- create your window
- call
OnMessage
as many times as you need - call
a.Wait()
The last call should block (which is normal) and your app should be working fine.