-
Notifications
You must be signed in to change notification settings - Fork 0
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
hashchange / even source? #73
Comments
Hi Dmitry, there is already a generic function for listening to events. Here is the part in the README that talks about it: https://github.com/chrisguttandin/subscribable-things#ontarget-eventtarget-type-string-options-boolean--addeventlisteneroptions-subscribablethingevent. Here is the integration test which probably documents it better: subscribable-things/test/integration/on.js Lines 115 to 134 in a1aa54a
Does that help with your use case? |
Right
A couple of off-topics, if you don't mind.
on(target: EventTarget, type: string, options?: boolean | AddEventListenerOptions): SubscribableThingThe keywords get lost in type definitions, makes it a bit hard to find. Would it make sense to making it more lightweight as: on(target, type, options?)on(target: EventTarget, type: string, options?: boolean | AddEventListenerOptions): SubscribableThing<Event> |
Thanks a lot for your suggestion. I just updated the README. 41983a3 It looks much better now. I'm not sure about adding a Currently the I wonder if there is already a collection of operators that could be reused somehow. |
Looks nice! Yeah, I also doubt about As for the operators library - good idea. In value-ref I came to But there indeed seems to be missing a small lib for observables with minimal set of operators and reactive sources (value/object/list). Like tiny rxjs, or reactive lodash. Sort of less proprietary vue reactivity. |
Maybe we could create a package called It could provide some operators and a const newObservable = pipe(
oldObservable,
map((value) => value + 2),
filter((value) => value % 2 === 0)
); Like in RxJS an operator would be a function which takes an But it almost feels unrealistic to me that something like this doesn't exist yet. 🤷♂️ |
I like the idea, but I think that is rxjs/operators we're talking about, unless there's a point for a separate portable lib with minimal set of indispensable ones. Yeah, it can also possibly subscribe to |
To the point there is: |
Thanks for all the links. It looks like it's a solved problem. ;-) Should we then close this issue? Or am I missing something? |
I guess, yes. |
Alright, I'm going to close it. Please feel free to open a new issue if you have another idea how this library could be extended or improved. |
Found myself implementing wrapper for
hashchange
event as:Does it make sense to provide hash source? Or mb location? Probably it's vast topic.
?
The text was updated successfully, but these errors were encountered: