My initial response that any generalization of Event Listening is
indistinguishable from an EventBus.
I'm generally in favour of EventBuses, but would raise two points which
have bitten me in the past:
* if the event bus / generalized listener manager is does not handle
threading, then this leads to a class of threading bugs. I ding Otto for
this reason (here's a PR implementing that behaviour
<https://github.com/square/otto/pull/72>).
* keeping the wiring separate and away from the implementation.
* some careful thought needs to go into making sure we're not chucking
around undifferentiated/untyped message or data objects. Otto is pretty
good for this, but probably a bit too simple.
perhaps it's time to start thinking about consistent use of messaging for
inter-component communication.
The new NativeJSObject stuff in the new sendMessageToJava is a good
start, though there is too much registering, deregistering and switching
for my tastes.
My f2f discussions with mfinkle would indicate he's not impressed by
more RPC type implementations.
-- james
On 5/6/14, 12:48 PM, Lucas Rocha wrote:
Which brings me to my conclusion: if we're reaching Peak Listener -- that is,
if we're starting to roll up ad hoc notification systems, considering
abusing sendMessageToJava, or discussing consistent listener implementations
on the mailing list -- then perhaps it's time to start thinking about
consistent use of messaging for inter-component communication.
I agree. Josh has posted some patches introducing the notion of an event bus
(using Square's Otto) in bug 1005352. I've posted some follow-up questions that
we probably want to put some thought on before going ahead with such approach:
https://bugzilla.mozilla.org/show_bug.cgi?id=1005352#c4
--lucasr
_______________________________________________
mobile-firefox-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/mobile-firefox-dev
_______________________________________________
mobile-firefox-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/mobile-firefox-dev