Created
July 30, 2019 04:10
-
-
Save jmuzsik/62430898767ccf760220f8ed8852be56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
startBackgroundTasks() { | |
console.info('Background Tasks have begun.'); | |
// Subtlety: Data is reset if start is clicked multiple times repeated clicks. | |
this.totalTaskCount = 0; | |
this.currentTaskNumber = 0; | |
this.updateDisplay(); | |
// Create a bunch of tasks. | |
const n = this.getRandomIntInclusive(200, 400); | |
for (let i = 0; i < n; i++) { | |
const taskData = { | |
// The amount of elements that will be created in this task. | |
count: this.getRandomIntInclusive(150, 300), | |
// The text that will be rendered in the element. | |
text: `This text is from task number ${(i + 1).toString()} of ${n}` | |
}; | |
this.enqueueTask(this.logTaskHandler, taskData); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment