I spent a while today trying to figure out how to work with an “observable Property” and had a hard time finding documentation on it. (In my case, I’m trying to get a notification when the scene mode changes.)
After digging into the source, I found subscribeAndEvaluate() which is just what the doctor ordered.
Seems as though that function is omitted from the online documentation. Is it meant to be? Should I add it?
That function is marked as private, so that’s why it’s no included in the online documentation.
We use Knockout to control data binding and automatic UI refreshing for our widgets. They have good documentation and a really helpful interactive tutorial on their website: http://knockoutjs.com/documentation/introduction.html
We use the Knockout ES5 plugin so we can use regular javascript syntax when working with these observables instead of having to use the observables like functions: https://github.com/SteveSanderson/knockout-es5
subscribeAndEvaluate is a helper function for adding a subscription to the knockout observable.
Is there another, preferred way to “observe” an “observable property” (as noted in the docs) or are observable properties meant only for private consumption within Cesium.
It really depends what you’re trying to do. Most users wouldn’t need to interact directly with the observable, which is probably why we have subscribeAndEvaluate marked private
You should be fine using that function if it’s working for you