Hi Yang,
You don't really need to watch both properties. You can just watch for `stationary` and keep some info around:
function whenZoomChange(view, callback) {
let oldScale;
view.watch('stationary', (isStationary) => {
if (!isStationary) {
oldScale = view.scale;
}
else {
if (oldScale !== view.scale) {
callback();
}
}
});
});
On the academic discussion, we made the choice to favor watching properties over events as it gives more control over events.
- Events don't give us access to the current state of the emitter. If your code gets a mapview object and it's already zooming, without a property expressing that you cannot know it, while `stationary` gives out this information.
- Having events AND properties just blows up the API with redundant information.