Tasks - Paultje52/background-tasks GitHub Wiki

There are different ways to execute functions on another threads. These are all the functions.

Constructing class

let threadManager = new BackgroundTasks(); // Spawn thread manager

ExecuteNow()

With executeNow(), you'll execute a function when a worker is available (Workers aren't available while executing a task). You can force-send a task by adding true after the function parameter.

ExecuteNow() has one parameter: The function. Add parameters before adding the function to send parameters for your function.

let someURL = "https://example.com";
threadManager.executeNow(someURL, (url) => {
  // "url" is "https://example.com"
}, true /* Force-send your task */);