Skip to content

Instantly share code, notes, and snippets.

@jmuzsik
Created July 30, 2019 04:13
Show Gist options
  • Save jmuzsik/864e20b0f22cde27bd463edc188505c1 to your computer and use it in GitHub Desktop.
Save jmuzsik/864e20b0f22cde27bd463edc188505c1 to your computer and use it in GitHub Desktop.
// Adds to task queue.
enqueueTask(taskHandler, taskData) {
this.taskList.push({
// taskHandler is this.logTaskHandler
handler: taskHandler,
/*
An object as so:
{
count: 104,
text: "This text is from task number 90 of 100"
}
*/
data: taskData
});
// Keep track of length of list
this.totalTaskCount++;
// It is only null when the component first renders
if (!this.taskHandle) {
this.taskHandle = requestIdleCallback(this.runTaskQueue);
}
this.scheduleStatusRefresh();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment