Changelog
0.9.3
Q.timeout
's errors a custom error message. #270
@jgrenonprocess.nextTick
to setImmediate
. #254 #259process
global without a nextTick
property. #267Q.promise
throw early if given a non-function.Changelog
0.9.2
timeout
. #229 @omaresdelay
.nbind
to actually bind the thisArg
. #232 @davidpadburyChangelog
0.9.1
namespace
option. #225 @terinjokesvalueOf
, and thus from isFulfilled
, isRejected
,
and isPending
. #226 @benjamnChangelog
0.9.0
This release removes many layers of deprecated methods and brings Q closer to alignment with Mark Miller’s TC39 [strawman][] for concurrency. At the same time, it fixes many bugs and adds a few features around error handling. Finally, it comes with an updated and comprehensive [API Reference][].
The following deprecated or undocumented methods have been removed. Their replacements are listed here:
<table> <thead> <tr> <th>0.8.x method</th> <th>0.9 replacement</th> </tr> </thead> <tbody> <tr> <td><code>Q.ref</code></td> <td><code>Q</code></td> </tr> <tr> <td><code>call</code>, <code>apply</code>, <code>bind</code> (*)</td> <td><code>fcall</code>/<code>invoke</code>, <code>fapply</code>/<code>post</code>, <code>fbind</code></td> </tr> <tr> <td><code>ncall</code>, <code>napply</code> (*)</td> <td><code>nfcall</code>/<code>ninvoke</code>, <code>nfapply</code>/<code>npost</code></td> </tr> <tr> <td><code>end</code></td> <td><code>done</code></td> </tr> <tr> <td><code>put</code></td> <td><code>set</code></td> </tr> <tr> <td><code>node</code></td> <td><code>nbind</code></td> </tr> <tr> <td><code>nend</code></td> <td><code>nodeify</code></td> </tr> <tr> <td><code>isResolved</code></td> <td><code>isPending</code></td> </tr> <tr> <td><code>deferred.node</code></td> <td><code>deferred.makeNodeResolver</code></td> </tr> <tr> <td><code>Method</code>, <code>sender</code></td> <td><code>dispatcher</code></td> </tr> <tr> <td><code>send</code></td> <td><code>dispatch</code></td> </tr> <tr> <td><code>view</code>, <code>viewInfo</code></td> <td>(none)</td> </tr> </tbody> </table>(*) Use of thisp
is discouraged. For calling methods, use post
or
invoke
.
Q(value)
function, an alias for resolve
.
Q.call
, Q.apply
, and Q.bind
were removed to make room for the
same methods on the function prototype.invoke
has been aliased to send
in all its forms.post
with no method name acts like fapply
.Q.stackJumpLimit
to zero.
In the future, this property will be used to fine tune how many stack jumps
are retained in long stack traces; for now, anything nonzero is treated as
one (since Q only tracks one stack jump at the moment, see #144). #168delete
and set
(née put
) no longer have a fulfillment value.thenReject
is now included, as a counterpart to thenResolve
.nextTick
shim is now faster. #195 @rkatic.fbind
no longer hard-binds the returned function's this
to undefined
.
#202Q.reject
no longer leaks memory. #148npost
with no arguments now works. #207allResolved
now works with non-Q promises ("thenables"). #179keys
behavior is now correct even in browsers without native
Object.keys
. #192 @rkaticisRejected
and the exception
property now work correctly if the
rejection reason is falsy. #198dispatchPromise(resolve, op, operands)
instead of sendPromise(op, resolve, ...operands)
, which reduces the cases where Q needs to do
argument slicing.Q.fulfill
has been added. It is distinct from Q.resolve
in that
it does not pass promises through, nor coerces promises from other
systems. The promise becomes the fulfillment value. This is only
recommended for use when trying to fulfill a promise with an object that has
a then
function that is at the same time not a promise.Changelog
0.8.12
Q.isFulfilled
; this lets Q.all
work on arrays containing foreign promises. #154Changelog
0.8.11
nfcall
, nfapply
, and nfbind
as thisp
-less versions of
ncall
, napply
, and nbind
. The latter are now deprecated. #142error.stack
in a rejection handler will now give a long stack
trace. #103Q.timeout
to clear its timeout handle when the promise is rejected;
previously, it kept the event loop alive until the timeout period expired.
#145 @dfilatovq/queue
module, which exports an infinite promise queue
constructor.Changelog
0.8.10
done
as a replacement for end
, taking the usual fulfillment,
rejection, and progress handlers. It's essentially equivalent to
then(f, r, p).end()
.Q.onerror
, a settable error trap that you can use to get full stack
traces for uncaught errors. #94thenResolve
as a shortcut for returning a constant value once a
promise is fulfilled. #108 @ForbesLindesaynend
to nodeify
. It no longer returns an always-fulfilled
promise when a Node callback is passed.deferred.resolve
and deferred.reject
no longer (sometimes) return
deferred.promise
.end
twice. #116 #121 @ef4ninvoke
and npost
to work on promises for objects with Node
methods. #134valueOf
methods,
like Date
s, by the promise's valueOf
method. #135spread
not calling the passed rejection handler if given a rejected
promise.Changelog
0.8.9
nend
promise.then(onFulfilled, onRejected, onProgress)
,
promise.progress(onProgress)
, and deferred.notify(...progressData)
.put
and del
return the object acted upon for easier chaining.
#84