Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork15.2k
enhancement: store.subscribe(listener, filter)#2814
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
new (optional) input parameter: `filter`* its purpose is to conditionally filter when `listener` is called* when its value is: * undefined: * `listener` is called as normal * `function`: * input: (oldState, newState) * output: boolean * when truthy, `listener` is not informed of this state change * `boolean` && true: * `listener` is not informed when `newState` is equal (by reference) to `oldState`
warren-bank commentedJan 28, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hi. I was just thinking..
Do you have any opinion? |
markerikson commentedJan 29, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
This is very similar to the frequently-requested idea of having state and/or action passed to listeners, and we have no plans to implement this. If you'd like to do it yourself, you can implement it as a store enhancer. For more info, see the FAQ entry onwhy state and action are not passed to subscribers, and the many prior discussions listed in issue#580 . |
new (optional) input parameter:
filterlisteneris calledlisteneris called as normalfunction:listeneris not informed of this state changeboolean&& true:listeneris not informed whennewStateis equal (by reference) to
oldState