ekuefler / gwt-supereventbus

High-octane event bus for GWT
https://ekuefler.github.io/gwt-supereventbus
Apache License 2.0
39 stars 2 forks source link

Subtyping doesn't work with overlay #5

Closed arnor2000 closed 11 years ago

arnor2000 commented 11 years ago

I don't think it's a SuperEventBus bug, rather an overlay limitation but it should be at least documented.

Overlays are viewed only as JavaScriptObject and never as defined subtypes, causing all posted JSO subtypes events to be sent to all JSO subtypes subscribers.

ekuefler commented 11 years ago

That's too bad. I think you're right that there's nothing SuperEventBus can do here since we don't have enough type information. Dispatching objects to handlers that aren't expecting them would be pretty dangerous, so I think it's best to fail fast and not allow JSOs to be posted at all. The workaround would be to wrap the JSO in an event object of some sort. I've added the check and a warning in the docs, thanks for pointing this out.