-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
could fromEvent support .on() and .off() #345
Comments
Most promotes a declarative approach to this kind of thing. What that would mean is that subscribing to a stream would invoke |
I'm working on a project in which I have to attach the same handler to a set of elements. Using a library like jquery I would do something like this: $('a').on('click', ev => {...}) I think that's a very common thing to do... fromEvent('click', $('a'))
.map(...)
.... I just had to alias out the |
It's important to remember that there are different philosophies and approaches to programming. RxJS and jQuery both promote an imperative approach to writing software, and their APIs are therefore built around that mindset. With Most, you have just as much power to do these things as with other libraries; it's just that the approach is a little different. The cleanest approach would be to implement a simple producer source. Here's an example from a project I'm working on: See lines 78-81 to see how I then consume the source. Note that you'll want to use If you learn to write producers in this way for special cases not handled by the base library and community extensions, it'll give you a lot of power to handle whatever scenario you are presented with. I recommend you also take a look at the architecture wiki page for a deeper understanding of what's going on here. |
Cool. Thanks for the links. I quite a noob in frp and I'm sure these will help me. I'll read it all. |
Libraries like socket.io and jquery exposes .on() and .off() methods to add and remove listeners.
RxJS supports these methods in addition to add/removeEventListener, could most support them too?
The text was updated successfully, but these errors were encountered: