Skip to content

Rename on(), off() functions to watch(), ignore() - #1

Open
danhardman wants to merge 1 commit into
amorey:masterfrom
danhardman:patch-1
Open

Rename on(), off() functions to watch(), ignore()#1
danhardman wants to merge 1 commit into
amorey:masterfrom
danhardman:patch-1

Conversation

@danhardman

Copy link
Copy Markdown

I've only renamed the fields on the returned singleton for now to keep things simple, but I think on() and off() functions don't make sense without an attributed action. Typically you'd get on('click',...) for example.

This just makes things clear that you're setting up a watcher/listener on the CSS selector.

I've only renamed the fields on the returned singleton for now to keep things simple, but I think `on()` and `off()` functions don't make sense without an attributed action. Typically you'd get `on('click',...)` for example.

This just makes things clear that you're setting up a watcher/listener on the CSS selector.
@amorey

amorey commented Sep 18, 2017

Copy link
Copy Markdown
Owner

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()?

@danhardman

Copy link
Copy Markdown
Author

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.

@distums

distums commented Sep 19, 2017

Copy link
Copy Markdown

How about observe() and disconnect()? MutationObserver has these methods.

@leipert

leipert commented Sep 20, 2017

Copy link
Copy Markdown

What about subscribe() and unsubscribe() like with es6 observables [1]

[1]: https://github.com/tc39/proposal-observable#example-observing-keyboard-events

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants