subscribeAndEvaluate not in online documentation?

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?

  • Dave

Hi Dave,

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:

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:

subscribeAndEvaluate is a helper function for adding a subscription to the knockout observable.


Makes sense.

So, I’ve actually tried using it like this:



… and it works well.

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


The public API for interacting with the observables is the knockout-es5 and Knockout APIs which are documented as Hannah linked to above.

For example:

Cesium.knockout.getObservable(viewer.infoBox.viewModel, ‘showInfo’).subscribe(function(newValue) {



“getObservable” is part of knockout-es5, which returns a normal Knockout observable, which has “subscribe”, as well as many other capabilities.

Thanks Scott.

I didn’t immediately realize I had access to Knockout via the Cesium namespace (it’s not in the documentation either, I don’t think?)

In any case, I’ll prefer your recommended API below.

  • Dave