# este-dispatcher

> Flux like dispatcher with promises.

Latest version **0.2.10** (published 2014-12-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install este-dispatcher
pnpm add este-dispatcher
yarn add este-dispatcher
bun add este-dispatcher
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.10 |
| Published | 2014-12-16 |
| First published | 2014-10-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Daniel Steigerwald |
| Maintainers | steida |
| Keywords | flux, dispatcher, promises |

## Links

- npm: https://www.npmjs.com/package/este-dispatcher
- Repository: https://github.com/steida/este-dispatcher
- Issues: https://github.com/steida/este-dispatcher/issues
- npm.io page: https://npm.io/package/este-dispatcher

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 0.2.10 (latest) — 2014-12-16
- 0.2.9 — 2014-12-16
- 0.2.8 — 2014-11-24
- 0.2.7 — 2014-11-24
- 0.2.6 — 2014-11-24
- 0.2.5 — 2014-11-01
- 0.2.4 — 2014-11-01
- 0.2.3 — 2014-10-24
- 0.2.2 — 2014-10-17
- 0.2.1 — 2014-10-13
- 0.2.0 — 2014-10-13
- 0.1.15 — 2014-10-13

## README

# este.Dispatcher [![Build Status](https://secure.travis-ci.org/steida/este-dispatcher.png?branch=master)](http://travis-ci.org/steida/este-dispatcher) [![Dependency Status](https://david-dm.org/steida/este-dispatcher.png)](https://david-dm.org/steida/este-dispatcher) [![devDependency Status](https://david-dm.org/steida/este-dispatcher/dev-status.png)](https://david-dm.org/steida/este-dispatcher#info=devDependencies)
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/steida/este-dispatcher?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Isomorphic Facebook [Flux](https://github.com/facebook/flux) like dispatcher with [promises](https://promisesaplus.com/) support. Made with [Este.js](https://github.com/steida/este).

## Features

  - Dispatcher with Promises api: All app sync/async actions and errors can be orchestrated across all app layers easily.
  - App errors can be reported via provided `onError` hook.
  - Isomorphic, Bower and Node.js versions included.
  - Bower version for production is super small, only 2.7 kB (gzipped). Yes, [Closure Compiler](https://developers.google.com/closure/compiler/).

## Install

For [Bower](http://bower.io/).

```
  bower install steida/este-dispatcher --save
```

For [Node.js](http://nodejs.org/).

```
  npm install este-dispatcher --save
```

## Usage

For [Bower](http://bower.io/).

```html
  // Dev
  <script src="bower_components/este-dispatcher/dispatcher.js"></script>
  // Production
  <script src="bower_components/este-dispatcher/dispatcher.min.js"></script>
```

For [Node.js](http://nodejs.org/).

```js
  var Dispatcher = require('este-dispatcher');
```

## Dispatcher API

Check [tests](https://github.com/steida/este-library/blob/master/este/dispatcher/dispatcher_test.coffee) or [source](https://github.com/steida/este-library/blob/master/este/dispatcher/dispatcher.coffee).

#### register

```js
/**
  @param {Function} callback
  @return {number} ID of registered callback.
*/
register(callback)
```

#### unregister

```js
/**
  @param {number} id ID of registered callback.
*/
unregister(id)
```

#### onError

```js
/**
  For error reporting.
  @param {string} action
  @param {*} reason
*/
onError(action, reason)
```

#### dispatch

```js
/**
  @param {string} action
  @param {Object=} payload Data for action.
  @return {!goog.Promise}
*/
dispatch(action, payload)
```

#### waitFor

```js
/**
  @param {Array.<number>} ids Callbacks IDs.
  @return {!goog.Promise}
*/
waitFor(ids)
```

## goog.Promises API

Check [goog/promise/promise.js](https://github.com/google/closure-library/blob/master/closure/goog/promise/promise.js)

---
_Source: https://npm.io/package/este-dispatcher · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
