samples/js/q.js
function coerce(promise) {
        var deferred = defer();
        nextTick(function () {
            try {
                promise.then(deferred.resolve, deferred.reject, deferred.notify);
            } catch (exception) {
                deferred.reject(exception);
            }
        });
        return deferred.promise;
    }
function coerce(promise) {
        var deferred = defer();
        nextTick(function () {
            try {
                promise.then(deferred.resolve, deferred.reject, deferred.notify);
            } catch (exception) {
                deferred.reject(exception);
            }
        });
        return deferred.promise;
    }
function coerce ( promise ) { var deferred = defer ( ) ; nextTick ( function ( ) { try { promise . then ( deferred . resolve , deferred . reject , deferred . notify ) ; } catch ( exception ) { deferred . reject ( exception ) ; } } ) ; return deferred . promise ; }
Converts thenables to Q promises.
@param promise thenable promise
@returns a Q promise
Converts thenables to Q promises .