You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 KiB
29 KiB
1.5.1
- Q.any now annotates its error message to clarify that Q.any was involved and includes only the last error emitted. (Ivan Etchart)
- Avoid domain.dispose during tests in preparation for Node.js 9. (Anna Henningsen)
1.5.0
- Q.any gives an error message from the last rejected promise
- Throw if callback supplied to "finally" is invalid (@grahamrhay)
- Long stack trace improvements, can now construct long stack traces across rethrows.
1.4.1
- Address an issue that prevented Q from being used as a
<script>for Firefox add-ons. Q can now be used in any environment that provideswindoworselfglobals, favoringwindowsince add-ons have an an immutableselfthat is distinct fromwindow.
1.4.0
- Add
noConflictsupport for use in<script>(@jahnjw).
1.3.0
- Add tracking for unhandled and handled rejections in Node.js (@benjamingr).
1.2.1
- Fix Node.js environment detection for modern Browserify (@kahnjw).
1.2.0
- Added Q.any(promisesArray) method (@vergara). Returns a promise fulfilled with the value of the first resolved promise in promisesArray. If all promises in promisesArray are rejected, it returns a rejected promise.
1.1.2
- Removed extraneous files from the npm package by using the "files" whitelist in package.json instead of the .npmignore blacklist. (@anton-rudeshko)
1.1.1
- Fix a pair of regressions in bootstrapping, one which precluded
WebWorker support, and another that precluded support in
<script>usage outright. #607
1.1.0
- Adds support for enabling long stack traces in node.js by setting
environment variable
Q_DEBUG=1. - Introduces the
tapmethod to promises, which will see a value pass through without alteration. - Use instanceof to recognize own promise instances as opposed to thenables.
- Construct timeout errors with
code === ETIMEDOUT(Kornel Lesiński) - More descriminant CommonJS module environment detection.
- Dropped continuous integration for Node.js 0.6 and 0.8 because of
changes to npm that preclude the use of new
^version predicate operator in any transitive dependency. - Users can now override
Q.nextTick.
1.0.1
- Adds support for
Q.Promise, which implements common usage of the ES6Promiseconstructor and its methods.Promisedoes not have a valid promise constructor and a proper implementation awaits version 2 of Q. - Removes the console stopgap for a promise inspector. This no longer works with any degree of reliability.
- Fixes support for content security policies that forbid eval. Now
using the
StopIterationglobal to distinguish SpiderMonkey generators from ES6 generators, assuming that they will never coexist.
1.0.0
🍰 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.
- Q will now attempt to post a debug message in browsers regardless of whether window.Touch is defined. Chrome at least now has this property regardless of whether touch is supported by the underlying hardware.
- 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 should be migrated from usage that cannot be altered.
0.9.7
- ⚠️
q.min.jsis no longer checked-in. It is however still created by Grunt and NPM. - Fixes a bug that inhibited
Q.asyncwith implementations of the new ES6 generators. - Fixes a bug with
nextTickaffecting Safari 6.0.5 the first time a page loads when aniframeis involved. - Introduces
passByCopy,join, andrace. - Shows stack traces or error messages on the console, instead of
Errorobjects. - Elimintates wrapper methods for improved performance.
Q.allnow propagates progress notifications of the form you might expect of ES6 iterations,{value, index}where thevalueis the progress notification from the promise atindex.
0.9.6
- Fixes a bug in recognizing the difference between compatible Q promises, and Q promises from before the implementation of "inspect". The latter are now coerced.
- Fixes an infinite asynchronous coercion cycle introduced by former solution, in two independently sufficient ways. 1.) All promises returned by makePromise now implement "inspect", albeit a default that reports that the promise has an "unknown" state. 2.) The implementation of "then/when" is now in "then" instead of "when", so that the responsibility to "coerce" the given promise rests solely in the "when" method and the "then" method may assume that "this" is a promise of the right type.
- Refactors
nextTickto use an unrolled microtask within Q regardless of how new ticks a requested. #316 @rkatic
0.9.5
- Introduces
inspectfor getting the state of a promise as{state: "fulfilled" | "rejected" | "pending", value | reason}. - Introduces
allSettledwhich 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. - Long stack traces are now off by default. Set
Q.longStackSupportto true to enable long stack traces. - Long stack traces can now follow the entire asynchronous history of a promise, not just a single jump.
- Introduces
spawnfor an immediately invoked asychronous generator. @jlongster - Support for experimental synonyms
mapply,mcall,nmapply,nmcallfor method invocation.
0.9.4
isPromiseandisPromiseAlikenow always returns a boolean (even for falsy values). #284 @lfac-pt- Support for ES6 Generators in
async#288 @andywingo - Clear duplicate promise rejections from dispatch methods #238 @SLaks
- Unhandled rejection API #296 @domenic
stopUnhandledRejectionTracking,getUnhandledReasons,resetUnhandledRejections.
0.9.3
- Add the ability to give
Q.timeout's errors a custom error message. #270 @jgrenon - Fix Q's call-stack busting behavior in Node.js 0.10, by switching from
process.nextTicktosetImmediate. #254 #259 - Fix Q's behavior when used with the Mocha test runner in the browser, since
Mocha introduces a fake
processglobal without anextTickproperty. #267 - Fix some, but not all, cases wherein Q would give false positives in its unhandled rejection detection (#252). A fix for other cases (#238) is hopefully coming soon.
- Made
Q.promisethrow early if given a non-function.
0.9.2
- Pass through progress notifications when using
timeout. #229 @omares - Pass through progress notifications when using
delay. - Fix
nbindto actually bind thethisArg. #232 @davidpadbury
0.9.1
- Made the AMD detection compatible with the RequireJS optimizer's
namespaceoption. #225 @terinjokes - Fix side effects from
valueOf, and thus fromisFulfilled,isRejected, andisPending. #226 @benjamn
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.
API Cleanup
The following deprecated or undocumented methods have been removed. Their replacements are listed here:
| 0.8.x method | 0.9 replacement |
|---|---|
Q.ref |
Q |
call, apply, bind (*) |
fcall/invoke, fapply/post, fbind |
ncall, napply (*) |
nfcall/ninvoke, nfapply/npost |
end |
done |
put |
set |
node |
nbind |
nend |
nodeify |
isResolved |
isPending |
deferred.node |
deferred.makeNodeResolver |
Method, sender |
dispatcher |
send |
dispatch |
view, viewInfo |
(none) |
(*) Use of thisp is discouraged. For calling methods, use post or
invoke.
Alignment with the Concurrency Strawman
- Q now exports a
Q(value)function, an alias forresolve.Q.call,Q.apply, andQ.bindwere removed to make room for the same methods on the function prototype. invokehas been aliased tosendin all its forms.postwith no method name acts likefapply.
Error Handling
- Long stack traces can be turned off by setting
Q.stackJumpLimitto 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). #168 - In Node.js, if there are unhandled rejections when the process exits, they are output to the console. #115
Other
deleteandset(néeput) no longer have a fulfillment value.- Q promises are no longer frozen, which helps with performance.
thenRejectis now included, as a counterpart tothenResolve.- The included browser
nextTickshim is now faster. #195 @rkatic.
Bug Fixes
- Q now works in Internet Explorer 10. #186 @ForbesLindesay
fbindno longer hard-binds the returned function'sthistoundefined. #202Q.rejectno longer leaks memory. #148npostwith no arguments now works. #207allResolvednow works with non-Q promises ("thenables"). #179keysbehavior is now correct even in browsers without nativeObject.keys. #192 @rkaticisRejectedand theexceptionproperty now work correctly if the rejection reason is falsy. #198
Internals and Advanced
- The internal interface for a promise now uses
dispatchPromise(resolve, op, operands)instead ofsendPromise(op, resolve, ...operands), which reduces the cases where Q needs to do argument slicing. - The internal protocol uses different operands. "put" is now "set". "del" is now "delete". "view" and "viewInfo" have been removed.
Q.fulfillhas been added. It is distinct fromQ.resolvein 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 athenfunction that is at the same time not a promise.
0.8.12
- Treat foreign promises as unresolved in
Q.isFulfilled; this letsQ.allwork on arrays containing foreign promises. #154 - Fix minor incompliances with the Promises/A+ spec and test suite. #157 #158
0.8.11
- Added
nfcall,nfapply, andnfbindasthisp-less versions ofncall,napply, andnbind. The latter are now deprecated. #142 - Long stack traces no longer cause linearly-growing memory usage when chaining promises together. #111
- Inspecting
error.stackin a rejection handler will now give a long stack trace. #103 - Fixed
Q.timeoutto clear its timeout handle when the promise is rejected; previously, it kept the event loop alive until the timeout period expired. #145 @dfilatov - Added
q/queuemodule, which exports an infinite promise queue constructor.
0.8.10
- Added
doneas a replacement forend, taking the usual fulfillment, rejection, and progress handlers. It's essentially equivalent tothen(f, r, p).end(). - Added
Q.onerror, a settable error trap that you can use to get full stack traces for uncaught errors. #94 - Added
thenResolveas a shortcut for returning a constant value once a promise is fulfilled. #108 @ForbesLindesay - Various tweaks to progress notification, including propagation and transformation of progress values and only forwarding a single progress object.
- Renamed
nendtonodeify. It no longer returns an always-fulfilled promise when a Node callback is passed. deferred.resolveanddeferred.rejectno longer (sometimes) returndeferred.promise.- Fixed stack traces getting mangled if they hit
endtwice. #116 #121 @ef4 - Fixed
ninvokeandnpostto work on promises for objects with Node methods. #134 - Fixed accidental coercion of objects with nontrivial
valueOfmethods, likeDates, by the promise'svalueOfmethod. #135 - Fixed
spreadnot calling the passed rejection handler if given a rejected promise.
0.8.9
- Added
nend - Added preliminary progress notification support, via
promise.then(onFulfilled, onRejected, onProgress),promise.progress(onProgress), anddeferred.notify(...progressData). - Made
putanddelreturn the object acted upon for easier chaining. #84 - Fixed coercion cycles with cooperating promises. #106
0.8.7
- Support Montage Require
0.8.6
- Fixed
npostandninvoketo pass the correctthisp. #74 - Fixed various cases involving unorthodox rejection reasons. #73 #90 @ef4
- Fixed double-resolving of misbehaved custom promises. #75
- Sped up
Q.allfor arrays contain already-resolved promises or scalar values. @ForbesLindesay - Made stack trace filtering work when concatenating assets. #93 @ef4
- Added warnings for deprecated methods. @ForbesLindesay
- Added
.npmignorefile so that dependent packages get a slimmernode_modulesdirectory.
0.8.5
- Added preliminary support for long traces (@domenic)
- Added
fapply,fcall,fbindfor non-thisp promised function calls. - Added
returnfor async generators, where generators are implemented. - Rejected promises now have an "exception" property. If an object isRejected(object), then object.valueOf().exception will be the wrapped error.
- Added Jasmine specifications
- Support Internet Explorers 7–9 (with multiple bug fixes @domenic)
- Support Firefox 12
- Support Safari 5.1.5
- Support Chrome 18
0.8.4
- WARNING:
promise.timeoutis now rejected with anErrorobject 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. - Added
deferred.makeNodeResolver()to replace the more crypticdeferred.node()method. - Added experimental
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. - Added experimental
Q.begin()that is intended to kick off chains of.thenso that each of these can be reordered without having to edit the new and former first step.
0.8.3
- Added
isFulfilled,isRejected, andisResolvedto the promise prototype. - Added
allResolvedfor waiting for every promise to either be fulfilled or rejected, without propagating an error. @utvara #53 - Added
Q.bindas a method to transform functions that return and throw into promise-returning functions. See an example. @domenic - Renamed
nodeexport tonbind, and addednapplyto complete the set.noderemains as deprecated. @domenic #58 - Renamed
Methodexport tosender.Methodremains as deprecated and will be removed in the next major version since I expect it has very little usage. - Added browser console message indicating a live list of unhandled errors.
- Added support for
msSetImmediate(IE10) orsetImmediate(available via polyfill) as a browser-sidenextTickimplementation. #44 #50 #59 - Stopped using the event-queue dependency, which was in place for
Narwhal support: now directly using
process.nextTick. - WARNING: EXPERIMENTAL: added
finallyalias forfin,catchalias forfail,tryalias forcall, anddeletealias fordel. These properties are enquoted in the library for cross-browser compatibility, but may be used as property names in modern engines.
0.8.2
- Deprecated
refin favor ofresolveas recommended by @domenic. - Update event-queue dependency.
0.8.1
0.8.0
- WARNING:
enqueueremoved. UsenextTickinstead. This is more consistent with NodeJS and (subjectively) more explicit and intuitive. - WARNING:
defremoved. Usemasterinstead. The termdefwas too confusing to new users. - WARNING:
spyremoved in favor offin. - WARNING:
waitremoved. Doall(args).get(0)instead. - WARNING:
joinremoved. Doall(args).spread(callback)instead. - WARNING: Removed the
Qfunction module.exports alias forQ.ref. It conflicts withQ.applyin weird ways, making it uncallable. - Revised
delayso that it accepts both(value, timeout)and(timeout)variations based on arguments length. - Added
ref().spread(cb(...args)), a variant ofthenthat spreads an array across multiple arguments. Useful withall(). - Added
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 withspread. - Added
nodeandncall, both with the signature(fun, thisp_opt, ...args). The former is a decorator and the latter calls immediately.nodeoptional binds and partially applies.ncallcan bind and pass arguments.
0.7.2
- Fixed thenable promise assimilation.
0.7.1
- Stopped shimming
Array.prototype.reduce. The enumerable property has bad side-effects. Libraries that depend on this (for example, QQ) will need to be revised.
0.7.0 - BACKWARD INCOMPATIBILITY
- WARNING: Removed
reportandasap - WARNING: The
callbackargument of thefinfunction no longer receives any arguments. Thus, it can be used to call functions that should not receive arguments on resolution. Usewhen,then, orfailif you need a value. - IMPORTANT: Fixed a bug in the use of
MessageChannelfornextTick. - Renamed
enqueuetonextTick. - Added experimental
viewandviewInfofor creating views of promises either when or before they're fulfilled. - Shims are now externally applied so subsequent scripts or dependees can use them.
- Improved minification results.
- Improved readability.
0.6.0 - BACKWARD INCOMPATIBILITY
- WARNING: In practice, the implementation of
spyand the namefinwere useful. I've removed the oldfinimplementation and renamed/aliasedspy. - The "q" module now exports its
reffunction 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. - Added
asyncdecorator for generators that use yield to "trampoline" promises. In engines that support generators (SpiderMonkey), this will greatly reduce the need for nested callbacks. - Made
whenchainable. - Made
allchainable.
0.5.3
- Added
alland refactoredjoinandwaitto use it. All of these will now reject at the earliest rejection.
0.5.2
- Minor improvement to
spy; now waits for resolution of callback promise.
0.5.1
- Made most Q API methods chainable on promise objects, and
turned the previous promise-methods of
join,wait, andreportinto Q API methods. - Added
applyandcallto the Q API, andapplyas a promise handler. - Added
fail,fin, andspyto Q and the promise prototype for convenience when observing rejection, fulfillment and rejection, or just observing without affecting the resolution. - Renamed
def(althoughdefremains shimmed until the next major release) tomaster. - Switched to using
MessageChannelfor next tick task enqueue in browsers that support it.
0.5.0 - MINOR BACKWARD INCOMPATIBILITY
- Exceptions are no longer reported when consumed.
- Removed
errorfrom the API. Since exceptions are getting consumed, throwing them in an errback causes the exception to silently disappear. Useend. - Added
endas 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 emituncaughtExceptionevents, and browsers to likewise emitonerrorand log to the console. - Added
joinandwaitas 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.
0.4.4
endno longer returns a promise. It is the end of the promise chain.- Stopped reporting thrown exceptions in
whencallbacks and errbacks. These must be explicitly reported through.end(),.then(null, Q.error), or some other mechanism. - Added
reportas an API method, which can be used as an errback to report and propagate an error. - Added
reportas a promise-chain method, so an error can be reported if it passes such a gate.
0.4.3
- Fixed
<script>support that regressed with 0.4.2 because of "use strict" in the module system multi-plexer.
0.4.2
- Added support for RequireJS (jburke)
0.4.1
- 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 error message.
0.4.0 - BACKWARD INCOMPATIBLE*
- *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.
- *In a non-CommonJS browser, q.js can be used as a script. It now creates a Q global variable.
- Fixed thenable assimilation.
- Fixed some issues with asap, when it resolves to undefined, or throws an exception.
0.3.0 - BACKWARD-INCOMPATIBLE
- The
postmethod has been reverted to its original signature, as provided in Tyler Close'sref_sendAPI. That is,postaccepts two arguments, the second of which is an arbitrary object, but usually invocation arguments as anArray. To provide variadic arguments topost, there is a newinvokefunction that posts the variadic arguments to the value given in the first argument. - The
definedmethod has been moved fromqtoq/utilsince it gets no use in practice but is still theoretically useful. - The
Promiseconstructor has been renamed tomakePromiseto be consistent with the convention that functions that do not require thenewkeyword to be used as constructors have camelCase names. - The
isResolvedfunction has been renamed toisFulfilled. There is a newisResolvedfunction 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.
0.2.10
- Added
jointo"q/util"for variadically joining multiple promises.
0.2.9
- The future-compatible
invokemethod has been added, to replacepost, sincepostwill become backward- incompatible in the next major release. - Exceptions thrown in the callbacks of a
whencall are now emitted to Node's"uncaughtException"processevent in addition to being returned as a rejection reason.
0.2.8
- Exceptions thrown in the callbacks of a
whencall are now consumed, warned, and transformed into rejections of the promise returned bywhen.
0.2.7
- Fixed a minor bug in thenable assimilation, regressed because of the change in the forwarding protocol.
- Fixed behavior of "q/util"
deepmethod on dates and other primitives. Github issue #11.
0.2.6
- Thenables (objects with a "then" method) are accepted and provided, bringing this implementation of Q into conformance with Promises/A, B, and D.
- Added
makePromise, to replace thePromisefunction eventually. - Rejections are now also duck-typed. A rejection is a promise with a valueOf method that returns a rejection descriptor. A rejection descriptor has a "promiseRejected" property equal to "true" and a "reason" property corresponding to the rejection reason.
- Altered the
makePromiseAPI such that thefallbackmethod no longer receives a superfluousresolvedmethod after theoperator. 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.
0.2.5
- 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 that implements the
promiseSend(op, resolved, ...)method andvalueOf". - Exceptions in promises are now captured and returned as rejections.
0.2.4
- Fixed bug in
refthat preventeddelmessages from being received (gozala) - Fixed a conflict with FireFox 4; constructor property is now read-only.
0.2.3
- Added
keysmessage to promises and to the promise API.
0.2.2
- Added boilerplate to
q/queueandq/util. - Fixed missing dependency to
q/queue.
0.2.1
- The
resolveandrejectmethods ofdeferobjects now return the resolution promise for convenience. - Added
q/util, which providesstep,delay,shallow,deep, and three reduction orders. - Added
q/queuemodule for a promiseQueue. - Added
q-commto the list of compatible libraries. - Deprecated
definedfromq, with intent to move it toq/util.
0.2.0 - BACKWARD INCOMPATIBLE
- Changed post(ref, name, args) to variadic post(ref, name, ...args). BACKWARD INCOMPATIBLE
- Added a def(value) method to annotate an object as being necessarily a local value that cannot be serialized, such that inter-process/worker/vat promise communication libraries will send messages to it, but never send it back.
- Added a send(value, op, ...args) method to the public API, for forwarding messages to a value or promise in a future turn.
0.1.9
- Added isRejected() for testing whether a value is a rejected promise. isResolved() retains the behavior of stating that rejected promises are not resolved.
0.1.8
- Fixed isResolved(null) and isResolved(undefined) [issue #9]
- Fixed a problem with the Object.create shim
0.1.7
- shimmed ES5 Object.create in addition to Object.freeze for compatibility on non-ES5 engines (gozala)
0.1.6
- Q.isResolved added
- promise.valueOf() now returns the value of resolved and near values
- asap retried
- promises are frozen when possible
0.1.5
- fixed dependency list for Teleport (gozala)
- all unit tests now pass (gozala)
0.1.4
- added support for Teleport as an engine (gozala)
- simplified and updated methods for getting internal print and enqueue functions universally (gozala)
0.1.3
- fixed erroneous link to the q module in package.json
0.1.2
- restructured for overlay style package compatibility
0.1.0
- removed asap because it was broken, probably down to the philosophy.
0.0.3
- removed q-util
- fixed asap so it returns a value if completed
0.0.2
- added q-util
0.0.1
- initial version