bond.js

0.0.1 • Public • Published

bond.js

Usage

bond.js can be used in by browser or node.js based applications.

node.js

Grab with npm:

npm install bond.js

Require in your app:

var bond = require('bond.js');

browser

<script src="bond.js"></script>

API

Create a promise

  var b = bond();
  var promise = b.promise;

Add handlers

promise.then(function (value) {
  alert(value);
}, function (error) {
  alert(error.message);
});

Fulfill the promise

b.fulfill('happy');
// alert: 'happy'

Reject the promise:

b.reject(new Error('sorry'));
// alert: 'sorry'

Readme

Keywords

none

Package Sidebar

Install

npm i bond.js

Weekly Downloads

1

Version

0.0.1

License

BSD

Last publish

Collaborators

  • sethmcl