I think you should go for the annotation processor, since that seems to be the Dagger way. AutoFactory works fine with the same concept.
El viernes, 11 de diciembre de 2015, 5:44:34 (UTC-3), Erik Kuefler escribió:
-- El viernes, 11 de diciembre de 2015, 5:44:34 (UTC-3), Erik Kuefler escribió:
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment