You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'm building a GTK app (using gotk4), using fx to create some of the Views and their backing models, and letting fx figure out hierarchy of dependencies for everything (view gets data from model, model gets data from database, database needs outstanding migrations run first, etc).
Unfortunately the Views (and other things) can only be safely (ie without panicing) constructed after the GTK subsystem has called the ConnectActivate callback of my gtk.Application. This callback is called when I call app.Run(...).
Describe the solution you'd like
Good question. I know I could spin up a separate fx.App inside my ConnectActivate callback, but I would lose all the rest of my wiring, and would have to figure out logging again, etc.. so I don't really want that.
Maybe I want to be able to be passed an invoker of sorts:
func NewApp(l *zap.Logger, invokerCalledOnActivate fx.Invoker) *gtk.Application {
gtkApp := ...
gtkApp.ConnectActivate(func() {
invokerCalledOnActivate.Invoke()
}
return gtkApp
}
// NewUIDuringActivation only gets resolved by fx in the ConnectActivate callback above.
func NewUIDuringActivation(gtkApp *gtk.App, myTree *gtk.TreeView, myModel *gtk.TreeModel) InvokerCalledOnActivate {
invoker := &defaultInvoker {
// member variables so that Invoke() eventually runs
gtkApp.Attach(myTree)
...
return invoker
}
..but that feels awkward.
Maybe I want to do all my initialization an OnStart ? That also seems suboptimal since my main goal is to create some of these dependencies during my ConnectActivate, not have them registered to be called later.
Maybe I wish executeInvoke was public and accessible through fx.App ?
Describe alternatives you've considered
See above.
Is this a breaking change?
No. This would be additive.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I'm building a GTK app (using gotk4), using fx to create some of the Views and their backing models, and letting fx figure out hierarchy of dependencies for everything (view gets data from model, model gets data from database, database needs outstanding migrations run first, etc).
Unfortunately the Views (and other things) can only be safely (ie without panicing) constructed after the GTK subsystem has called the
ConnectActivate
callback of mygtk.Application
. This callback is called when I callapp.Run(...)
.Describe the solution you'd like
Good question. I know I could spin up a separate
fx.App
inside myConnectActivate
callback, but I would lose all the rest of my wiring, and would have to figure out logging again, etc.. so I don't really want that.Maybe I want to be able to be passed an invoker of sorts:
..but that feels awkward.
Maybe I want to do all my initialization an
OnStart
? That also seems suboptimal since my main goal is to create some of these dependencies during my ConnectActivate, not have them registered to be called later.Maybe I wish
executeInvoke
was public and accessible throughfx.App
?Describe alternatives you've considered
See above.
Is this a breaking change?
No. This would be additive.
The text was updated successfully, but these errors were encountered: