Share a client-side singleton across modules?

223 views
Skip to first unread message

Hamlet D'Arcy

unread,
Jan 17, 2011, 4:49:37 AM1/17/11
to Google Web Toolkit
I would like to share a client singleton across GWT modules. Is this
possible? If so, how?

I have several modules that need to share an EventBus (SimpleEventBus)
instance. Creating a singleton in GWT Java code and having all modules
inherit from the common module did not work. Each of the root modules
has a different instance of the EventBus.

I also tried using the replace-with and create() approach documented
in ClientFactory of GWT MVC and that did not work. Each module had
it's own instance.

Ideas?

Thanks in advance,

Raphael André Bauer

unread,
Jan 17, 2011, 6:52:51 AM1/17/11
to google-we...@googlegroups.com


This only works if modules are inherited and compiled into one
nochache.js file. If you have several webpages each inheriting a
different nochache.js it will not work.

On the other hand: If you inherit modules from each other it works.


Cheers,

Raphael

>
> Thanks in advance,
>
> --
> You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
> To post to this group, send email to google-we...@googlegroups.com.
> To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages