0.2.10 • Published 11 years ago

este-dispatcher v0.2.10

Weekly downloads
4
License
MIT
Repository
github
Last release
11 years ago

este.Dispatcher Build Status Dependency Status devDependency Status

Gitter(https://badges.gitter.im/Join Chat.svg)

Isomorphic Facebook Flux like dispatcher with promises support. Made with Este.js.

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.

Install

For Bower.

  bower install steida/este-dispatcher --save

For Node.js.

  npm install este-dispatcher --save

Usage

For Bower.

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

For Node.js.

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

Dispatcher API

Check tests or source.

register

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

unregister

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

onError

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

dispatch

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

waitFor

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

goog.Promises API

Check goog/promise/promise.js

0.2.10

11 years ago

0.2.9

11 years ago

0.2.8

11 years ago

0.2.7

11 years ago

0.2.6

11 years ago

0.2.5

11 years ago

0.2.4

11 years ago

0.2.3

11 years ago

0.2.2

11 years ago

0.2.1

11 years ago

0.2.0

11 years ago

0.1.15

11 years ago