Open danhardman opened 6 years ago
Thanks! Let me think about it some more. I used on/off for symmetry with jQuery but I like watch()
. What do you think of disconnect()
instead of ignore()
?
Yeah it kinda clicked that ignore()
probably isn't the best name if its intended to only work when a watcher is already setup on that selector. disconnect()
or stop()
I think would work well.
How about observe()
and disconnect()
? MutationObserver has these methods.
What about subscribe()
and unsubscribe()
like with es6 observables [1]
[1]: https://github.com/tc39/proposal-observable#example-observing-keyboard-events
I've only renamed the fields on the returned singleton for now to keep things simple, but I think
on()
andoff()
functions don't make sense without an attributed action. Typically you'd geton('click',...)
for example.This just makes things clear that you're setting up a watcher/listener on the CSS selector.