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 "bind" method to store #276

Closed
artalar opened this issue Jan 15, 2020 · 3 comments · Fixed by #277
Closed

add "bind" method to store #276

artalar opened this issue Jan 15, 2020 · 3 comments · Fixed by #277
Assignees

Comments

@artalar
Copy link
Owner

artalar commented Jan 15, 2020

Wanna

const doSomeBinded = store.bind(doSome)

// get action
doSome()

// dispatch action
doSomeBinded()
@artalar artalar self-assigned this Jan 15, 2020
@belozer
Copy link
Contributor

belozer commented Jan 15, 2020

Why not const doSomeBinded = doSome.bind(store) ?

@artalar
Copy link
Owner Author

artalar commented Jan 15, 2020

Action is function thats already has a bind method

I think, may be, overload like:

actionCreator(payload): Action
actionCreator(store, payload): void

// USAGE
actionCreator.bind(null, strore) // here "bind" is native(!) method

@artalar artalar mentioned this issue Jan 16, 2020
@belozer
Copy link
Contributor

belozer commented Jan 16, 2020

const doSomeBinded = store.connect(doSome)
const atom = store.connect(MyAtom)

atom.getState()
doSomeBinded()

?

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 a pull request may close this issue.

2 participants