vipulz / gwt-phonegap

Automatically exported from code.google.com/p/gwt-phonegap
0 stars 0 forks source link

Allow phonegap to share the application eventbus #55

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be nice that we could set the phonegap eventbus when initializing the 
instance.
This would allow that anywhere in the app we could listen to phonegap events 
like menu button etc.

An easy way could be to overload the initialize method:
phoneGap.initializePhoneGap(10000, eventBus);

Another thing is that phonegap is using the deprecated namespace for the 
EventBus com.google.gwt.event.shared.EventBus instead of 
com.google.web.bindery.event.shared.EventBus

I can send a patch if you want.

- Manolo

Original issue reported on code.google.com by manuel.carrasco.m on 13 Jul 2012 at 10:59

GoogleCodeExporter commented 9 years ago
We could definitely pass the eventbus down inthe the event module and fire 
events directly on it. But I was enable / disable this with an option. 
Sometimes you don`t want those events on your global event bus.

A Patch is always appreciated (or a github pull request)

Original comment by kurka.da...@gmail.com on 13 Jul 2012 at 2:36

GoogleCodeExporter commented 9 years ago
This issue was closed by revision c0253b2b349e.

Original comment by kurka.da...@gmail.com on 15 Jul 2012 at 11:05

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 861f7499f596.

Original comment by kurka.da...@gmail.com on 15 Jul 2012 at 11:05

GoogleCodeExporter commented 9 years ago
Sent the pull request. With the patch it is possible to use this syntax:

eventBus.addHandler(PhoneGapAvailableEvent.TYPE, myPhoneGapAvailableHandler);
eventBus.addHandler(PhoneGapTimeoutEvent.TYPE, myPhoneGapTimeoutHandler)
eventBus.addHandler(BackButtonPressedEvent.TYPE, myBackButtonPressedHandler);
eventBus.addHandler(MenuButtonPressedEvent.TYPE, myMenuButtonPressedHandler);

// Create phonegap instance (could be done with Gin if the case)
PhoneGap phoneGap = GWT.create(PhoneGap.class)
phoneGap.setEventBus(eventBus);
// Initialize it
phoneGap.initializePhoneGap(10000);

Original comment by manuel.carrasco.m on 15 Jul 2012 at 11:06

GoogleCodeExporter commented 9 years ago

Original comment by kurka.da...@gmail.com on 15 Jul 2012 at 11:17

GoogleCodeExporter commented 9 years ago
thank you for taking the time to prepare this. Its really appreciated!

Original comment by kurka.da...@gmail.com on 15 Jul 2012 at 11:18

GoogleCodeExporter commented 9 years ago

Original comment by kurka.da...@gmail.com on 23 Sep 2012 at 7:40