0.2.10 • Published 9 years ago

este-dispatcher v0.2.10

Weekly downloads
4
License
MIT
Repository
github
Last release
9 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

9 years ago

0.2.9

9 years ago

0.2.8

9 years ago

0.2.7

9 years ago

0.2.6

9 years ago

0.2.5

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.15

10 years ago