Skip to content

Instantly share code, notes, and snippets.

@Tevinthuku
Last active August 14, 2019 17:03
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 Tevinthuku/f0fabdf851f100709a42e193c580af12 to your computer and use it in GitHub Desktop.
Save Tevinthuku/f0fabdf851f100709a42e193c580af12 to your computer and use it in GitHub Desktop.
const CLASS_COMPONENT = "class";
// ...code
export function scheduleUpdate(instance, partialState) {
workQueue.push({
from: CLASS_COMPONENT, // we know scheduleUpdate came from a class so we have CLASS_COMPONENT here.
instance: instance, // *this* object
partialState: partialState // this represents the state that needs to be changed
});
requestIdleCallback(performWork);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment