NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #2318 most downloaded on npm
A library for promises (CommonJS/Promises/A,B,D)
Last release 9 years ago
no release in 18 months
Ships unpredictably
gaps range from 8 days to 1.9 years
Unknown
no stable releases
76 versions withdrawn
withdrawn after publishing
16 years old
76 releases · first in 2010
Nothing published for this version
Nothing published for this version
One column per quarter.
Nothing published for this version
Nothing published for this version
Q.any now annotates its error message to clarify that Q.any was involved and includes only the last error emitted. (Ivan Etchart)
Q.any gives an error message from the last rejected promise
Address an issue that prevented Q from being used as a for Firefox add-ons. Q can now be used in any environment that provides window or self globals,
<script> for
Firefox add-ons. Q can now be used in any environment that provides window
or self globals, favoring window since add-ons have an an immutable
self that is distinct from window.Add noConflict support for use in (@jahnjw).
noConflict support for use in <script> (@jahnjw).Add tracking for unhandled and handled rejections in Node.js (@benjamingr).
Fix Node.js environment detection for modern Browserify (@kahnjw).
Added Q.any(promisesArray) method (@vergara). Returns a promise fulfilled with the value of the first resolved promise in promisesArray. If all promis
Removed extraneous files from the npm package by using the "files" whitelist in package.json instead of the .npmignore blacklist. (@anton-rudeshko)
Fix a pair of regressions in bootstrapping, one which precluded WebWorker support, and another that precluded support in usage outright. #607
<script> usage outright. #607Adds support for enabling long stack traces in node.js by setting environment variable Q_DEBUG=1.
Q_DEBUG=1.tap method to promises, which will see a value
pass through without alteration.code === ETIMEDOUT (Kornel Lesiński)^ version predicate
operator in any transitive dependency.Q.nextTick.Adds support for Q.Promise, which implements common usage of the ES6 Promise constructor and its methods. Promise does not have a valid promise constr
Q.Promise, which implements common usage of the
ES6 Promise constructor and its methods. Promise does not have
a valid promise constructor and a proper implementation awaits
version 2 of Q.StopIteration global to distinguish SpiderMonkey
generators from ES6 generators, assuming that they will never
coexist.Remove deprecation warning from promise.valueOf. The function is called by the browser in various ways so there is no way to distinguish usage that sh…
:cake: This is all but a re-release of version 0.9, which has settled into a gentle maintenance mode and rightly deserves an official 1.0. An ambitious 2.0 release is already around the corner, but 0.9/1.0 have been distributed far and wide and demand long term support.
promise.valueOf. The function is
called by the browser in various ways so there is no way to
distinguish usage that should be migrated from usage that cannot be
altered.:warning: q.min.js is no longer checked-in. It is however still created by Grunt and NPM.
q.min.js is no longer checked-in. It is however still
created by Grunt and NPM.Q.async with implementations of the new
ES6 generators.nextTick affecting Safari 6.0.5 the first time a
page loads when an iframe is involved.passByCopy, join, and race.Error objects.Q.all now propagates progress notifications of the form you might
expect of ES6 iterations, {value, index} where the value is the
progress notification from the promise at index.Fixes a bug in recognizing the difference between compatible Q promises, and Q promises from before the implementation of "inspect". The latter are no
nextTick to use an unrolled microtask within Q regardless
of how new ticks a requested. #316 @rkaticIntroduces inspect for getting the state of a promise as {state: "fulfilled" | "rejected" | "pending", value | reason}.
inspect for getting the state of a promise as
{state: "fulfilled" | "rejected" | "pending", value | reason}.allSettled which produces an array of promises states
for the input promises once they have all "settled". This is in
accordance with a discussion on Promises/A+ that "settled" refers to
a promise that is "fulfilled" or "rejected". "resolved" refers to a
deferred promise that has been "resolved" to another promise,
"sealing its fate" to the fate of the successor promise.Q.longStackSupport
to true to enable long stack traces.spawn for an immediately invoked asychronous generator.
@jlongstermapply, mcall, nmapply,
nmcall for method invocation.isPromise and isPromiseAlike now always returns a boolean (even for falsy values). #284 @lfac-pt
isPromise and isPromiseAlike now always returns a boolean
(even for falsy values). #284 @lfac-ptasync #288 @andywingostopUnhandledRejectionTracking, getUnhandledReasons,
resetUnhandledRejections.Add the ability to give Q.timeout's errors a custom error message. #270 @jgrenon
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.Pass through progress notifications when using timeout. #229 @omares
timeout. #229 @omaresdelay.nbind to actually bind the thisArg. #232 @davidpadburyMade the AMD detection compatible with the RequireJS optimizer's namespace option. #225 @terinjokes
namespace
option. #225 @terinjokesvalueOf, and thus from isFulfilled, isRejected,
and isPending. #226 @benjamnThis release removes many layers of deprecated methods and brings Q closer to alignment with Mark Miller’s TC39 [strawman][] for concurrency. At the s…
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.Treat foreign promises as unresolved in Q.isFulfilled; this lets Q.all work on arrays containing foreign promises. #154
Q.isFulfilled; this lets Q.all
work on arrays containing foreign promises. #154Added nfcall, nfapply, and nfbind as thisp-less versions of ncall, napply, and nbind. The latter are now deprecated. #142
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.Added done as a replacement for end, taking the usual fulfillment, rejection, and progress handlers. It's essentially equivalent to then(f, r, p).end(
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 Dates, by the promise's valueOf method. #135spread not calling the passed rejection handler if given a rejected
promise.Added preliminary progress notification support, via promise.then(onFulfilled, onRejected, onProgress), promise.progress(onProgress), and deferred.not
nendpromise.then(onFulfilled, onRejected, onProgress),
promise.progress(onProgress), and deferred.notify(...progressData).put and del return the object acted upon for easier chaining.
#84Nothing published for this version
- Support Montage Require
Added warnings for deprecated methods. @ForbesLindesay
npost and ninvoke to pass the correct thisp. #74Q.all for arrays contain already-resolved promises or scalar
values. @ForbesLindesay.npmignore file so that dependent packages get a slimmer
node_modules directory.Added preliminary support for long traces (@domenic)
fapply, fcall, fbind for non-thisp
promised function calls.return for async generators, where generators
are implemented.WARNING: promise.timeout is now rejected with an Error object and the message now includes the duration of the timeout in miliseconds. This doesn't co
promise.timeout is now rejected with an Error object
and the message now includes the duration of the timeout in
miliseconds. This doesn't constitute (in my opinion) a
backward-incompatibility since it is a change of an undocumented and
unspecified public behavior, but if you happened to depend on the
exception being a string, you will need to revise your code.deferred.makeNodeResolver() to replace the more cryptic
deferred.node() method.Q.promise(maker(resolve, reject)) to make a
promise inside a callback, such that thrown exceptions in the
callback are converted and the resolver and rejecter are arguments.
This is a shorthand for making a deferred directly and inspired by
@gozala’s stream constructor pattern and the Microsoft Windows Metro
Promise constructor interface.Q.begin() that is intended to kick off chains
of .then so that each of these can be reordered without having to
edit the new and former first step.Renamed node export to nbind, and added napply to complete the set. node remains as deprecated. @domenic #58
isFulfilled, isRejected, and isResolved
to the promise prototype.allResolved for waiting for every promise to either be
fulfilled or rejected, without propagating an error. @utvara #53Q.bind as a method to transform functions that
return and throw into promise-returning functions. See
an example. @domenicnode export to nbind, and added napply to
complete the set. node remains as deprecated. @domenic #58Method export to sender. Method
remains as deprecated and will be removed in the next
major version since I expect it has very little usage.msSetImmediate (IE10) or setImmediate
(available via polyfill)
as a browser-side nextTick implementation. #44 #50 #59process.nextTick.finally alias for fin, catch
alias for fail, try alias for call, and delete alias
for del. These properties are enquoted in the library for
cross-browser compatibility, but may be used as property names in
modern engines.Deprecated ref in favor of resolve as recommended by @domenic.
ref in favor of resolve as recommended by
@domenic.- Fixed Opera bug. #35 @cadorn - Fixed Q.all([]) #32 @domenic
Q.all([]) #32 @domenicWARNING: enqueue removed. Use nextTick instead. This is more consistent with NodeJS and (subjectively) more explicit and intuitive.
enqueue removed. Use nextTick instead.
This is more consistent with NodeJS and (subjectively)
more explicit and intuitive.def removed. Use master instead. The
term def was too confusing to new users.spy removed in favor of fin.wait removed. Do all(args).get(0) instead.join removed. Do all(args).spread(callback) instead.Q function module.exports alias
for Q.ref. It conflicts with Q.apply in weird
ways, making it uncallable.delay so that it accepts both (value, timeout) and (timeout) variations based on
arguments length.ref().spread(cb(...args)), a variant of
then that spreads an array across multiple arguments.
Useful with all().defer().node() Node callback generator. The
callback accepts (error, value) or (error, ...values). For multiple value arguments, the
fulfillment value is an array, useful in conjunction with
spread.node and ncall, both with the signature
(fun, thisp_opt, ...args). The former is a decorator
and the latter calls immediately. node optional
binds and partially applies. ncall can bind and pass
arguments.Fixed thenable promise assimilation.
Stopped shimming Array.prototype.reduce. The enumerable property has bad side-effects. Libraries that depend on this (for example, QQ) will need to be
Array.prototype.reduce. The
enumerable property has bad side-effects. Libraries that
depend on this (for example, QQ) will need to be revised.WARNING: Removed report and asap
report and asapcallback argument of the fin
function no longer receives any arguments. Thus, it can
be used to call functions that should not receive
arguments on resolution. Use when, then, or
fail if you need a value.MessageChannel
for nextTick.enqueue to nextTick.view and viewInfo for creating
views of promises either when or before they're
fulfilled.WARNING: In practice, the implementation of spy and the name fin were useful. I've removed the old fin implementation and renamed/aliased spy.
spy and
the name fin were useful. I've removed the old
fin implementation and renamed/aliased spy.ref function as a "Q"
constructor, with module systems that support exports
assignment including NodeJS, RequireJS, and when used as
a <script> tag. Notably, strictly compliant CommonJS
does not support this, but UncommonJS does.async decorator for generators that use yield
to "trampoline" promises. In engines that support
generators (SpiderMonkey), this will greatly reduce the
need for nested callbacks.when chainable.all chainable.Added all and refactored join and wait to use it. All of these will now reject at the earliest rejection.
all and refactored join and wait to use
it. All of these will now reject at the earliest
rejection.Minor improvement to spy; now waits for resolution of callback promise.
spy; now waits for resolution of
callback promise.Made most Q API methods chainable on promise objects, and turned the previous promise-methods of join, wait, and report into Q API methods.
join,
wait, and report into Q API methods.apply and call to the Q API, and apply
as a promise handler.fail, fin, and spy to Q and the promise
prototype for convenience when observing rejection,
fulfillment and rejection, or just observing without
affecting the resolution.def (although def remains shimmed until
the next major release) to master.MessageChannel for next tick task
enqueue in browsers that support it.Exceptions are no longer reported when consumed.
error from the API. Since exceptions are
getting consumed, throwing them in an errback causes the
exception to silently disappear. Use end.end as both an API method and a promise-chain
ending method. It causes propagated rejections to be
thrown, which allows Node to write stack traces and
emit uncaughtException events, and browsers to
likewise emit onerror and log to the console.join and wait as promise chain functions,
so you can wait for variadic promises, returning your own
promise back, or join variadic promises, resolving with a
callback that receives variadic fulfillment values.end no longer returns a promise. It is the end of the promise chain.
end no longer returns a promise. It is the end of the
promise chain.when callbacks
and errbacks. These must be explicitly reported through
.end(), .then(null, Q.error), or some other
mechanism.report as an API method, which can be used as
an errback to report and propagate an error.report as a promise-chain method, so an error
can be reported if it passes such a gate.Added support for RequireJS (jburke)
Added an "end" method to the promise prototype, as a shorthand for waiting for the promise to be resolved gracefully, and failing to do so, to dump an
*Removed the utility modules. NPM and Node no longer expose any module except the main module. These have been moved and merged into the "qq" package.
The post method has been reverted to its original signature, as provided in Tyler Close's ref_send API. That is, post accepts two arguments, the secon
post method has been reverted to its original
signature, as provided in Tyler Close's ref_send API.
That is, post accepts two arguments, the second of
which is an arbitrary object, but usually invocation
arguments as an Array. To provide variadic arguments
to post, there is a new invoke function that posts
the variadic arguments to the value given in the first
argument.defined method has been moved from q to q/util
since it gets no use in practice but is still
theoretically useful.Promise constructor has been renamed to
makePromise to be consistent with the convention that
functions that do not require the new keyword to be
used as constructors have camelCase names.isResolved function has been renamed to
isFulfilled. There is a new isResolved function that
indicates whether a value is not a promise or, if it is a
promise, whether it has been either fulfilled or
rejected. The code has been revised to reflect this
nuance in terminology.Added join to "q/util" for variadically joining multiple promises.
join to "q/util" for variadically joining
multiple promises.The future-compatible invoke method has been added, to replace post, since post will become backward- incompatible in the next major release.
invoke method has been added,
to replace post, since post will become backward-
incompatible in the next major release.when call are
now emitted to Node's "uncaughtException" process
event in addition to being returned as a rejection reason.Exceptions thrown in the callbacks of a when call are now consumed, warned, and transformed into rejections of the promise returned by when.
when call
are now consumed, warned, and transformed into
rejections of the promise returned by when.Fixed a minor bug in thenable assimilation, regressed because of the change in the forwarding protocol.
deep method on dates and
other primitives. Github issue #11.Thenables (objects with a "then" method) are accepted and provided, bringing this implementation of Q into conformance with Promises/A, B, and D.
makePromise, to replace the Promise function
eventually.makePromise API such that the fallback
method no longer receives a superfluous resolved method
after the operator. The fallback method is responsible
only for returning a resolution. This breaks an
undocumented API, so third-party API's depending on the
previous undocumented behavior may break.Changed promises into a duck-type such that multiple instances of the Q module can exchange promise objects. A promise is now defined as "an object th
promiseSend(op, resolved, ...) method and valueOf".Fixed bug in ref that prevented del messages from being received (gozala)
ref that prevented del messages from
being received (gozala)Added keys message to promises and to the promise API.
keys message to promises and to the promise API.Added boilerplate to q/queue and q/util.
q/queue and q/util.q/queue.Deprecated defined from q, with intent to move it to q/util.
resolve and reject methods of defer objects now
return the resolution promise for convenience.q/util, which provides step, delay, shallow,
deep, and three reduction orders.q/queue module for a promise Queue.q-comm to the list of compatible libraries.defined from q, with intent to move it to
q/util.Your coding agent can read these notes before it upgrades. Set up the MCP server →