Search code examples
gwtevent-bus

How to listen to ALL events dispatched on the GWT Event Bus?


I want to be able to listen to all events dispatched on the Event Bus, regardless of type. How can I do this?


Solution

  • Taking a cue from Thomas's suggestion, here is a sample solution:

        public class MyEventBus extends SimpleEventBus {
    
        @Override
        public void fireEvent( GwtEvent<?> event ) {
            trackEvent( "Event Fired", event.getClass().toString() );
            super.fireEvent( event );
        }
    
        public native void trackEvent( String category, String action ) /*-{
            $wnd._gaq.push([ '_trackEvent', category, action ]);
        }-*/;
    }