I have a use case where I need to compile separate entry points into
separate javascript files and one or multiple files arbitrarily on different
pages.  This is common with JSR-168 portlets, but plenty of other types of
apps might need this.

The problem is that I can't find a mechanism outside of writing JSNI code to
a pub/sub system such as this:
https://github.com/phiggins42/bloody-jquery-plugins/blob/master/pubsub.js

I've wrapped that code into a PubSub.java class here:
http://azprogrammer.com/gwt/PubSub.java
That class contains all the JSNI I should need, so I figure if I want say:
 application GwtA to communicate with application GwtB I'd have to write
JSNI code in those apps to use the Global bus crated by PubSub.  And that
works, but I'd rather PubSub was just a utility and have GwtA and GwtB not
require subscribing with JSNI.

So I created a Subsciber interface:
public interface Subscriber {
public void handleEvent(String name, Object val);
}





The GwtA & B apps could just:

PubSub m_pubSub = new PubSub();
//send with:
m_pubSub.publish("sendName", "Value from gwtA");

//or subcribe with:
m_pubSub.subscribe("sendName", new Subscriber() {
public void handleEvent(String name, Object val) {
   //do something
}
});



This works fine once the app is compiled.  I can even pub and sub to the
event bus with external non-GWT code in the page.
However, it doesn't work in dev mode in eclipse.    I'm sure stuff only
working once compiled is a bug, but I can't really wait for this to be
fixed.

Is there a better way to achieve Pub/Sub globally on separately compiled GWT
apps?  Can whatever mechanism that is be exported to be used by non-GWT
code?


Thanks,

Luis Montes

-- 
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to