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

Expose a way to start/stop listening observable reads outside of a function #51

Closed
BigAB opened this issue Feb 6, 2017 · 1 comment
Closed

Comments

@BigAB
Copy link
Contributor

BigAB commented Feb 6, 2017

To solve the problem where, the reads that need to be observed are not encapsulated in a function calls.

This will probably require changing observation to allow not providing a function as the first argument:

var observation = new Observation(null, null, function(newVal, oldVal, batchNum){
    console.log("callback", newVal, oldVal, batchNum);
    this.reRender()
})

So that we can observe the operation asynchronously and update in some callback

  componentWillUpdate() {
    observation.pushToStack()
  }
  componentDidUpdate() {
    observation.popFromStack()
  }
@BigAB
Copy link
Contributor Author

BigAB commented Feb 8, 2017

If we expose the stateful parts of can-observation, observationStack and the remaining counter object, we could subclass and have this kind of modification in ur code without making changes to the core can-observation

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

No branches or pull requests

1 participant