-
-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pref: instead of debounce 20ms, using requestIdleCallback to delay calculation #425
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
1976b51
to
159d2a5
Compare
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 9bc1bba:
|
159d2a5
to
9bc1bba
Compare
if (idleCallbackId) { | ||
window.cancelIdleCallback(idleCallbackId); | ||
} | ||
idleCallbackId = window.requestIdleCallback(deadline => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Safari browser does not support requestIdleCallback.
idleCallbackId = null; | ||
calculateTableWidth(entries[0].contentRect.width); | ||
} else { | ||
changeTableWidthWhenResize(entries); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changeTableWidthWhenResize(entries); | |
// If there is not enough idle time, try again in a future idle period. | |
// Use setTimeout to avoid stack overflow if this function is called too frequently. | |
setTimeout(() => { | |
changeTableWidthWhenResize(entries); | |
}, 50); |
No description provided.