almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs
7.85k stars 1.48k forks source link

Retrieve all timeline events at x time #3959

Open juliandv opened 6 years ago

juliandv commented 6 years ago

I'm trying to retrieve a list of all timeline events at a given time.

getVisibleItems() seems to be the closest method, returning an array of IDs within the view, but I'm after a list from an intersection of a time point, e.g. the current date time.

Use case: 5 minutes before any calendar event, alert user with a reminder popup. Multiple popups could occur at a time, and they should be dismissed when calendar event is in the past

brichbe commented 6 years ago

Have a look at the DataSet documentation here and look at the subsection "Data Filtering". You can see here how to use the DataSet.get() method, providing a filter function is where you can do the checks necessary to return only those items at a given time, or like your use case, items that begin in the next 5 minutes. If the returned array has items, prompt the user as needed.