medikoo / deferred

Modular and fast Promises implementation for JavaScript
ISC License
364 stars 20 forks source link

bluebird interop #29

Closed zowers closed 10 years ago

zowers commented 10 years ago

.then() receives foreign promise (bluebird) instead of resolved value e.g:

var deferred = require("deferred");
var Promise = require("bluebird");
deferred("deferred")
    .then( function() {
        return Promise.resolve("foreign");
    } )
    .then( function( result ) {
        if( result != "foreign" );
            throw new Error( "unexpected result: " + JSON.stringify(result) );
        console.log("ok")
    } )
    .catch( function( err ) {
        console.error( err );
    } );
> [Error: unexpected result: {"isFulfilled":true,"isRejected":false,"fulfillmentValue":"foreign"}]
medikoo commented 10 years ago

Yes, deferred currently does not assimilate foreign promises, however it'll be fixed with next version.

Do you need it in your project?

zowers commented 10 years ago

yes, that would be very useful

medikoo commented 10 years ago

Implemented and published with v0.7.0

zowers commented 10 years ago

thanks