2016-02-18 21:26:18 +00:00
|
|
|
# taskbuffer
|
|
|
|
Flexible task organization for gulp.
|
|
|
|
|
|
|
|
## Status
|
|
|
|
[![Coverage Status](https://coveralls.io/repos/github/pushrocks/taskbuffer/badge.svg?branch=master)](https://coveralls.io/github/pushrocks/taskbuffer?branch=master)
|
|
|
|
|
|
|
|
## Install
|
|
|
|
|
|
|
|
```sh
|
|
|
|
npm install taskbuffer --save
|
2016-05-04 02:11:22 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Concepts
|
|
|
|
|
|
|
|
#### Task
|
|
|
|
* A Task in its most simple form is a function that is executed when the task runs.
|
2016-05-04 03:11:08 +00:00
|
|
|
* A Task can have a **preTask** and an **afterTask**
|
|
|
|
(those are run before or after the main function whenever the task is called)
|
|
|
|
* A Task can be buffered.
|
|
|
|
That means it can be called multiple times in a very short time.
|
|
|
|
However execution happens in line:
|
|
|
|
meaning execution of the task's main function is on halt until the previous task call has finished.
|
|
|
|
You can set bufferMax number, which is the max number of buffered task calls.
|
|
|
|
Any additional calls will then be truncated
|
2016-05-04 02:17:59 +00:00
|
|
|
* Task.trigger() and Task.triggerBuffered() always return a Promise;
|
|
|
|
* Task.triggered() is an ObservableStram that emits events every time a task is promised.
|
|
|
|
* Task is compatible to gulp streams.
|
|
|
|
|
|
|
|
#### Taskchain
|
|
|
|
* Multiple Tasks can be combined in a bigger task using a Taskchain. Taskchain extends Task.
|
|
|
|
|