subscribing to change in clock.currentTime

Hello. I’m trying to figure out a way to subscribe to any changes in the clock’s current time made by the user via the timeline. I do not want to follow the onTick event since I have shouldAnimate and canAnimate set to false. But if the user clicks in the timeline and changes the current time I would like to respond to that event.

Since the currentTime of the clock is observable my attempt is:

Cesium.knockout.getObservable(widget.clock, ‘currentTime’).subscribe((curr_time) => {
console.info(curr_time);
});

``

However, when I try this in the console I get:

Uncaught TypeError: Cannot read property ‘subscribe’ of null

``

I’m very new to both javascript and Cesium and I would appreciate any input. Thank you for your time.

Hello,

clock.currentTime is not a knockout observable, and therefore you can not subscribe to it.

Instead, you can listen to the Clock.onTick event to know when the time has changed.

Best,

Hannah