## Executor

Executes operations sequentially. Has an option for a buffer that can be triggered afterwards.

**Kind**: global class * [Executor](#Executor) * [new Executor()](#new_Executor_new) * [.push(task, [forceQueuing])](#Executor+push) * [.pushAsync(task, [forceQueuing])](#Executor+pushAsync) ⇒ Promise.<\*> * [.processBuffer()](#Executor+processBuffer) ### new Executor()

Instantiates a new Executor.

### executor.push(task, [forceQueuing])

If executor is ready, queue task (and process it immediately if executor was idle) If not, buffer task for later processing

**Kind**: instance method of [Executor](#Executor) **Params** - task Object - .this Object -

Object to use as this

- .fn function -

Function to execute

- .arguments Array -

Array of arguments, IMPORTANT: only the last argument may be a function (the callback) and the last argument cannot be false/undefined/null

- [forceQueuing] Boolean = false -

Optional (defaults to false) force executor to queue task even if it is not ready

### executor.pushAsync(task, [forceQueuing]) ⇒ Promise.<\*>

Async version of [push](#Executor+push). This version is way simpler than its callbackEquivalent: you give it an async function task, it is executed when all the previous tasks are done, and then resolves or rejects and when it is finished with its original result or error.

**Kind**: instance method of [Executor](#Executor) **See**: Executor#push **Params** - task [AsyncFunction](#AsyncFunction) - [forceQueuing] boolean = false ### executor.processBuffer()

Queue all tasks in buffer (in the same order they came in) Automatically sets executor as ready

**Kind**: instance method of [Executor](#Executor)