I took the code from the following GitHub and made certain modifications (like adding other extensions, etc...).
https://github.com/autodesk-platform-services/aps-iot-extensions-demo/tree/experiment/time-select
I tried to reproduce what was done in the GitHub below in order to update the dates displayed on the timeslider when the user selects new dates:
What I'm trying to reproduce is in the following functions: updateSelection() and createTimeSelection()
I used zoomTo in resolve to be able to zoom more precisely on the range of dates already selected but as soon as I leave this range the dates are no longer updated.
Example:
when loading the viewer the dates are from 12/30/2023 to 01/15/2024. If I put a date in this interval the timeslider updates, however as soon as I put for example 12/28/2024 the timeslider no longer changes
Here's what I did but I got the following error which I don't understand:
Uncaught TypeError: line.addTimeSelection is not a function : code
According to aps-iot-extensions-demo/blob/experiment/time-select/public/timeline.js#L10, the function
initTimelineis an async function, which returns a Promise, notTimeSliderobject. This why throw error thatline.addTimeSelection is not a function.To resolve this issue, there are two approaches:
thenfunction at line#31 of the index.jsOr Add await in front of
initTimelineto get correctTimeSliderobject: