SitePen / dgrid

A lightweight, mobile-ready, data-driven, modular grid widget designed for use with dstore
http://dgrid.io/
Other
628 stars 295 forks source link

Enable configuration of logic for throttling window resize handler #1306

Closed msssk closed 8 years ago

msssk commented 8 years ago

Duplicates #1303

adamdport commented 8 years ago

This is awesome. Thanks for the quick response!

msssk commented 8 years ago

@adamdport You're welcome! We're still evaluating this before merging it, but in the meantime if you can run this branch and share your experiences, that would be helpful. Let us know if you encounter any problems.

adamdport commented 8 years ago

I'm planning to spend today integrating this branch and I'll let you know how it works out.

However, I still feel that calculating every 15ms as a default is unnecessary. That equates to over 60 calculations every second. For comparison, most movies are filmed at 24 frames per second (42ms per frame).

msssk commented 8 years ago

The default throttle rate of 15ms gives approximately 60 fps, which is the industry standard for a smooth UI experience. In typical situations, this is not only an achievable, but reasonable goal.

It's only in very unusual scenarios where this is not achievable. For OnDemandList, the row update throttle rate (and method) is configurable, so if you find yourself in one of those uncommon scenarios you can change it.

This PR provides the same configurability for the window resize handler - if 15ms is not suitable in your situation, you change it, or you can debounce instead of throttle.

dylans commented 8 years ago

Agreed that 15ms is typically chosen to meet the goal of 60 fps. It's why it's also the default value for the pagingDelay configuration setting. This PR looks fine to me.

adamdport commented 8 years ago

Unfortunately I got pulled off of this and won't be able to test it for awhile. If this is still waiting to be merged when I return to it, I'll be sure to report my findings.

adamdport commented 8 years ago

I've cherry picked this PR into v1.1.0 and have had good results. No issues that I can tell.

edhager commented 8 years ago

Thanks @msssk!