I've been using Dagger 2 in my GWT app happily for several months now, and
am just starting to look into doing some more serious code splitting. Has
anyone put much thought into this or come up with good patterns?

The obvious way to do it is to inject a Provider<Foo> and then only call
.get() on that provider from inside a runAsync block. I vaguely recall this
working with Gin, but it doesn't seem to work with Dagger (Foo's code is
still in the main fragment). The other option is to handwrite a
FooAsyncProvider class that injects Foo's dependencies and has a get method
that takes a callback and manually constructs Foo in a runAsync block,
passing it to the callback. This seems to work but it's annoying to keep
Foo and FooAsyncProvider in sync with one another; I might end up writing
my own annotation processor to generate async providers if there isn't a
better way.

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to