frp-promise
v1.1.0
Published
will convert a Promise to a frp event
Downloads
4
Readme
frp-promise
will convert a Promise to a frp event. If the promise reject's a Javascript Error
will be returned with the rejecting message.
Usage
Example:
var promise = require( 'bluebird' );
var frpPromise = require( 'frp-promise' );
var resolving = promise.resolve( 'I am good' );
var rejecting = promise.reject( 'I am bad' );
frpPromise( resolving )
.watch( onWatch );
frpPromise( rejecting )
.watch( onWatch );
function onWatch( value ) {
if( value instanceof Error ) {
throw value; // will throw an Error with the message value of 'I am bad'
} else {
console.log( value ); // will console.log 'I am good'
}
}
License
MIT, see LICENSE.md for details.