diff --git a/README.md b/README.md index 33bf516..6fb2542 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,13 @@ Wrap your function. const task = backgroundTask(() => { // 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 -background task is true if the task was queued to `requestIdleCallback` immediately or `false` if there are previous invocations queued ahead of it. +Call `task` as you would any other async function. The return value is a promise for when the background task completes. Calling a task multiple times will queue the passed parameters and execute the task sequentially the same number of times.