Skip to content

Commit

Permalink
✏️ better doc
Browse files Browse the repository at this point in the history
  • Loading branch information
astoilkov committed Aug 23, 2023
1 parent b32fe51 commit 917c70f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/afterFrame.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import queueTask from './queueTask'

// inspired by: https://github.com/andrewiggins/afterframe
/**
* Calls the callback after the browser renders the next frame.
* Compared to requestAnimationFrame() that calls the callback before the next frame.
* Inspired by: https://github.com/andrewiggins/afterframe
* @param callback
*/
export default function afterFrame(callback: () => void): void {
requestAnimationFrame(() => {
queueTask(callback)
Expand Down

0 comments on commit 917c70f

Please sign in to comment.