Skip to content

Instantly share code, notes, and snippets.

@joehonton
Created June 18, 2022 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joehonton/6d112bdfbd958203cf84beb1053ed851 to your computer and use it in GitHub Desktop.
Save joehonton/6d112bdfbd958203cf84beb1053ed851 to your computer and use it in GitHub Desktop.
// A large array of points awaiting projection
var queue = [];
// index into the array of the next item to compute
var lastIndex = 0;
var idleCallbackId = 0;
. . .
if (queue.length > 0 && idleCallbackId == 0)
idleCallbackId = requestIdleCallback(computeLayout);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment