On Mon, Oct 10, 2016 at 5:14 PM, J. Ryan Stinnett <
jry...@gmail.com> wrote:
> I used RxJS v4 in a personal project, so I have a little bit of experience
> with libraries like these (but just a little!). So far, I haven't really
> felt the need to try one in DevTools myself. Lately I've been liking how
> we're all roughly aiming towards a similar design with React, Redux, etc.,
> so I would be a little hesitant to throw in reactive streams if it's only
> used sporadically...
>
> Can you give more details about where you'd want to use this? Is there a
> specific tool you have in mind?
>
I'm currently refactoring the Netmonitor tool to React/Redux and there are
at least two places where I could use a reactive stream:
At [1], we listen to two resize event streams (one from window, one from a
splitter element), merge them into one, debounce by RESIZE_REFRESH_RATE
(50ms) and then do some action (e.g., dispatch a "resize" action to the
Redux store).
At [2], we listen for search box keyboard events, debounce, and update the
filtering criteria.
The debounce logic is reimplemented again and again, sometimes with Chrome
timer APIs. And it's hard to things like creating the event stream in one
component and then passing it as a parameter to another component.
Of course, these two use cases are very simple and don't themselves justify
adding a new big library. But I believe that across the devtools codebase,
they are frequent enough to make a RX library worth it. It could be a
universal tool similar to promises or Task.js.
Also, I think a RX library is perfectly orthogonal to Redux - there is no
dilemma like "do X with Redux or with RX?", but rather these tools are
complementary to each other. Just another tool for async programming, like
promises or Task.js. Or am I wrong?
> I would suggest most.js or RxJS v5 because of their perf improvements vs.
> the others. However, I have not actually used these, so it would be best to
> investigate the APIs of each before choosing. API design is a pretty
> critical piece of a library like this.
>
As far as I'm concerned, I can live happily with any of the APIs - they are
not different enough from each other to make me care much.
Jordan mentioned a sdk/event/utils module - however, this one can't be used
in a non-privileged chrome code, and doesn't have the throttle/debounce
APIs I'd like to use.
Jarda
[1]
http://searchfox.org/mozilla-central/source/devtools/client/netmonitor/netmonitor-view.js#2446-2450
[2]
http://searchfox.org/mozilla-central/source/devtools/client/netmonitor/netmonitor-view.js#1035-1047