Skip to content
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

Add createToggle operator #294

Closed
sagdeev opened this issue Sep 13, 2023 · 6 comments
Closed

Add createToggle operator #294

sagdeev opened this issue Sep 13, 2023 · 6 comments
Labels
RFC Some new feature that should be discussed

Comments

@sagdeev
Copy link

sagdeev commented Sep 13, 2023

Hi! What do you think about new method createToggle? We often use the on/off state in our work. Can be used for popup or notify. Perhaps need a different name 🤔

Something like this:

const { $enabled, on, off, toggle, reset } = createToggle(false);

If everything is ok I can implement this 😃

@sergeysova sergeysova added the RFC Some new feature that should be discussed label Sep 17, 2023
@sergeysova
Copy link
Member

Not sure it is for patronum. Because patronum is the library of operators, not typical model factories.

But need to ask @AlexandrHoroshih and @igorkamyshev

@igorkamyshev
Copy link
Member

Not sure it is for patronum. Because patronum is the library of operators, not typical model factories.

But need to ask @AlexandrHoroshih and @igorkamyshev

timeout, debounce, and, or, equals, either, etc

So, almost all functions in patronum is factories. They creates some units and returns it.

@sergeysova
Copy link
Member

Maybe we need to choose a new name for this method?

@AlexandrHoroshih
Copy link
Member

AlexandrHoroshih commented Sep 20, 2023

I actually think, it is a pretty good name 😄

It could be shortened to fit more of "patronum naming style", like const someToggle = toggle(false), but this way it is a bit less obvios, what this thing actually does

So, i think, createToggle is a way to go

@AlexandrHoroshih
Copy link
Member

AlexandrHoroshih commented Sep 20, 2023

Actually, there is already a similiar proposal
#286

Looks like toggler it is a pretty good name too

@sergeysova
Copy link
Member

Duplicate of #286

@sergeysova sergeysova marked this as a duplicate of #286 Sep 26, 2023
@sergeysova sergeysova closed this as not planned Won't fix, can't repro, duplicate, stale Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC Some new feature that should be discussed
Projects
None yet
Development

No branches or pull requests

4 participants