Otaqui.com Blog

Bond – a simple Promises library, available with npm

I’ve released bond – a simple Promises/A implementation. The only reasons to use this library rather than something like node-promise are that it can be used in a browser as well as nodejs, it supports multiple arguments for promise callbacks (this is actually why I wrote it) and it has a cool name.

Bond installation is extremely easy with npm by adding it to your package.json file and executing “npm install”.

It provides two equivalent options for usage “new bond.Deferred()” or “bond.defer()”. This returns a deferred object with the usual methods:

* nb – providing “promise()” as a method rather than a property violates the CommonJS Promises/A spec, but I’ve seen it elsewhere and prefer it.