almende / vis

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

Timeout for long-rendering timelines #3352

Open abeverley opened 7 years ago

abeverley commented 7 years ago

If an attempt is made to display too many items on a timeline, for either a slow computer or inefficient browser, then the timeline can hang for a significant length of time. Sometimes browsers will offer the user the opportunity to cancel the javascript, but other times the user is forced to kill the browser.

Because the maximum number of items that can be displayed is variable, dependent on the end client, I would like to be able to offer a configurable option for the maximum length of time that the render should be attempted.

I am happy to look into this, I just wanted to raise it here first for initial comments. I am thinking 2 new configuration options: one for the maximum number of seconds to run for, and one for the code that would be run in the even of a time out.

Any thoughts?

macleodbroad-wf commented 7 years ago

I've been thinking of something like this, for automated performance regression testing, but I was thinking of, instead, just offering lifecycle callbacks.

Basically a set of callbacks that could be passed in and executed at particular hooks in the lifecycle of the visualization.

I believe this would allow you to accomplish what you're looking to do, and be flexible enough to be used by other cases as well.

abeverley commented 7 years ago

Thanks for the quick reply. Sounds great, although it's possibly getting beyond my (limited) JS abilities. Would you be interested in being sponsored to add such a feature?

yotamberk commented 7 years ago

definitely a good feature request. I can look at it. PM me about sponsoring.

abeverley commented 7 years ago

All - sorry for the late reply, and many thanks for the swift reaction to this issue.

@yotamberk - thanks - I'll PM you in a moment.