time-extent-change TimeSlider Event in 4x

223
1
Jump to solution
07-20-2022 02:50 PM
MichaelWen_Timmons
New Contributor III

I have an app written in JS API 3x that made extensive use of the 'time-extent-change' event to handle a lot of UI and background changes. I noticed that it is no longer available in JS API 4x. 

Is there a way to get an event to fire whenever a user moved the slider manually, or used the Play button in 4x?

 

0 Kudos
1 Solution

Accepted Solutions
AnneFitz
Esri Regular Contributor

You can watch the "timeExtent" property on TimeSlider, like this: 

timeSlider.watch("timeExtent", (newVal, oldVal) =>{
  // do something with the old and new values
  console.log("Old timeExtent: ", oldVal);
  console.log("New timeExtent: ", newVal);
});

 

View solution in original post

0 Kudos
1 Reply
AnneFitz
Esri Regular Contributor

You can watch the "timeExtent" property on TimeSlider, like this: 

timeSlider.watch("timeExtent", (newVal, oldVal) =>{
  // do something with the old and new values
  console.log("Old timeExtent: ", oldVal);
  console.log("New timeExtent: ", newVal);
});

 

0 Kudos