-
Notifications
You must be signed in to change notification settings - Fork 2
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 API for getting the value of an observation #130
Labels
Comments
This was referenced Apr 27, 2018
I’m going to go with option 2, creating a |
chasenlehara
added a commit
that referenced
this issue
Jul 2, 2018
This adds an API for getting the value of an observation by replacing the old internal `value` property with `_value` and adding a new `value` getter so the following works: ```js import Observation from "can-observation"; const observation = new Observation(() => 15); observation.value; // is 15 ``` Closes #130
chasenlehara
added a commit
that referenced
this issue
Jul 2, 2018
This adds an API for getting the value of an observation by replacing the old internal `value` property with `_value` and adding a new `value` getter so the following works: ```js import Observation from "can-observation"; const observation = new Observation(() => 15); observation.value; // is 15 ``` Closes #130
chasenlehara
added a commit
to canjs/can-simple-observable
that referenced
this issue
Jul 3, 2018
This adds an API for getting & setting the value of the observation returned by the key module: ```js import keyObservable from "can-simple-observable/key/key"; const outer = {inner: {key: "hello"}}; const observable = keyObservable(outer, "inner.key"); observable.value; // is "hello" observable.value = "goodbye"; observable.value; // is now "goodbye" ``` Related to canjs/can-observation#130
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Right now you can use can-reflect to get the value of an observation, but it’d be nice if there was a more simple API for doing that. Related, some observables build on top of can-observation and make it possible to set values; a consistent, friendly API for both getting and setting values would be nice.
Two options stick out to me:
set()
method. That would look something like:value
property on observations:The text was updated successfully, but these errors were encountered: