How to listen to SamplePositionProperty 'time reached event' ?

SamplePositionProperty has a method addSample(time, position, derivatives).

Saying I call this function three times

position.addSample('2018-1-1 12:00:00' ....)
position.addSample('2018-1-1 12:10:00' ....)
position.addSample('2018-1-1 12:20:00' ....)

Now I want to listen to the 'time' in the above method which means as Cesium clock time goes on and time equals to
2018-1-1 12:00:00, 2018-1-1 12:10:00, 2018-1-1 12:20:00, an event is dispatched and i could listen to it and do some extra works.

How can i do?

I think the easiest way would be to listen for the onTick event on the clock, and then check the time to see if it’s reached those milestones. This Sandcastle has an example of using the onTick:

It might be nice to have a helper so you can just listen for a particular time. Although I can imagine it can be a bit tricky. For example, should the event trigger only if it passes that time playing forward? What if time is playing in reverse? Or if you’re manually scrubbing the timeline back and forth?