Cleanup the README a bit
This commit is contained in:
parent
9194eeb709
commit
b400d28310
15
README.md
15
README.md
@ -5,21 +5,20 @@ An simple function wrapper around
|
|||||||
that queues tasks and runs them sequentially.
|
that queues tasks and runs them sequentially.
|
||||||
|
|
||||||
The main purpose is to be able to run maintainance functions that are not a good fit for a web
|
The main purpose is to be able to run maintainance functions that are not a good fit for a web
|
||||||
worker context.
|
worker context (i.e. methods that require the DOM).
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
Wrap your function.
|
Wrap your function.
|
||||||
|
|
||||||
```
|
```
|
||||||
const task = backgroundTask(() => {
|
const task = backgroundTask(() => {
|
||||||
// do stuff
|
// do stuff
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
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 function that has no return value. The return value of a
|
||||||
background task is the id from `requestIdleCallback` that can be passed to `cancelIdleCallback` if
|
background task is true if the task was queued to `requestIdleCallback` immediately or `false` if there are previous invocations queued ahead of it.
|
||||||
you wish to cancel the task before it runs.
|
|
||||||
|
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.
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user