Update README to reflect new features.

This commit is contained in:
Timothy Farrell 2019-07-23 16:07:33 -05:00
parent 06f8097609
commit c074ca1fb8

View File

@ -15,10 +15,13 @@ Wrap your function.
const task = backgroundTask(() => { const task = backgroundTask(() => {
// do stuff // do stuff
}); });
task().then(result => {
// task has finished.
});
``` ```
Call `task` as you would any other function that has no return value. The return value of a Call `task` as you would any other async function. The return value is a promise for when the background task completes.
background task is true if the task was queued to `requestIdleCallback` immediately or `false` if there are previous invocations queued ahead of it.
Calling a task multiple times will queue the passed parameters and execute the task sequentially the same number of times. Calling a task multiple times will queue the passed parameters and execute the task sequentially the same number of times.