## 0.9.4 (unreleased) - `isPromise` and `isPromiseAlike` now always returns a boolean (even for falsy values). #284 @lfac-pt ## 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.nextTick` to `setImmediate`. #254 #259 - Fix Q's behavior when used with the Mocha test runner in the browser, since Mocha introduces a fake `process` global without a `nextTick` property. #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.promise` throw 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 `nbind` to actually bind the `thisArg`. #232 @davidpadbury ## 0.9.1 - Made the AMD detection compatible with the RequireJS optimizer's `namespace` option. #225 @terinjokes - Fix side effects from `valueOf`, and thus from `isFulfilled`, `isRejected`, and `isPending`. #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][]. [strawman]: http://wiki.ecmascript.org/doku.php?id=strawman:concurrency [API Reference]: https://github.com/kriskowal/q/wiki/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 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`. ### Error Handling - Long stack traces can be turned off by setting `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). #168 - In Node.js, if there are unhandled rejections when the process exits, they are output to the console. #115 ### Other - `delete` and `set` (née `put`) no longer have a fulfillment value. - Q promises are no longer frozen, which [helps with performance](http://code.google.com/p/v8/issues/detail?id=1858). - `thenReject` is now included, as a counterpart to `thenResolve`. - The included browser `nextTick` shim is now faster. #195 @rkatic. ### Bug Fixes - Q now works in Internet Explorer 10. #186 @ForbesLindesay - `fbind` no longer hard-binds the returned function's `this` to `undefined`. #202 - `Q.reject` no longer leaks memory. #148 - `npost` with no arguments now works. #207 - `allResolved` now works with non-Q promises ("thenables"). #179 - `keys` behavior is now correct even in browsers without native `Object.keys`. #192 @rkatic - `isRejected` and the `exception` property 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 of `sendPromise(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.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. ## 0.8.12 - Treat foreign promises as unresolved in `Q.isFulfilled`; this lets `Q.all` work on arrays containing foreign promises. #154 - Fix minor incompliances with the [Promises/A+ spec][] and [test suite][]. #157 #158 [Promises/A+ spec]: http://promises-aplus.github.com/promises-spec/ [test suite]: https://github.com/promises-aplus/promises-tests ## 0.8.11 - Added ``nfcall``, ``nfapply``, and ``nfbind`` as ``thisp``-less versions of ``ncall``, ``napply``, and ``nbind``. The latter are now deprecated. #142 - Long stack traces no longer cause linearly-growing memory usage when chaining promises together. #111 - Inspecting ``error.stack`` in a rejection handler will now give a long stack trace. #103 - Fixed ``Q.timeout`` to 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/queue` module, which exports an infinite promise queue constructor. ## 0.8.10 - 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()``. - Added ``Q.onerror``, a settable error trap that you can use to get full stack traces for uncaught errors. #94 - Added ``thenResolve`` as 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 ``nend`` 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``. - Fixed stack traces getting mangled if they hit ``end`` twice. #116 #121 @ef4 - Fixed ``ninvoke`` and ``npost`` to work on promises for objects with Node methods. #134 - Fixed accidental coercion of objects with nontrivial ``valueOf`` methods, like ``Date``s, by the promise's ``valueOf`` method. #135 - Fixed ``spread`` not 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)``, and ``deferred.notify(...progressData)``. - Made ``put`` and ``del`` return the object acted upon for easier chaining. #84 - Fixed coercion cycles with cooperating promises. #106 ## 0.8.7 - Support [Montage Require](http://github.com/kriskowal/mr) ## 0.8.6 - Fixed ``npost`` and ``ninvoke`` to pass the correct ``thisp``. #74 - Fixed various cases involving unorthodox rejection reasons. #73 #90 @ef4 - Fixed double-resolving of misbehaved custom promises. #75 - Sped up ``Q.all`` for 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 ``.npmignore`` file so that dependent packages get a slimmer ``node_modules`` directory. ## 0.8.5 - Added preliminary support for long traces (@domenic) - Added ``fapply``, ``fcall``, ``fbind`` for non-thisp promised function calls. - Added ``return`` for 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.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. - Added ``deferred.makeNodeResolver()`` to replace the more cryptic ``deferred.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 ``.then`` so that each of these can be reordered without having to edit the new and former first step. ## 0.8.3 - Added ``isFulfilled``, ``isRejected``, and ``isResolved`` to the promise prototype. - Added ``allResolved`` for waiting for every promise to either be fulfilled or rejected, without propagating an error. @utvara #53 - Added ``Q.bind`` as a method to transform functions that return and throw into promise-returning functions. See [an example](https://gist.github.com/1782808). @domenic - Renamed ``node`` export to ``nbind``, and added ``napply`` to complete the set. ``node`` remains as deprecated. @domenic #58 - Renamed ``Method`` export to ``sender``. ``Method`` remains 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) or ``setImmediate`` (available via [polyfill](https://github.com/NobleJS/setImmediate)) as a browser-side ``nextTick`` implementation. #44 #50 #59 - Stopped using the event-queue dependency, which was in place for Narwhal support: now directly using ``process.nextTick``. - WARNING: EXPERIMENTAL: added ``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. ## 0.8.2 - Deprecated ``ref`` in favor of ``resolve`` as recommended by @domenic. - Update event-queue dependency. ## 0.8.1 - Fixed Opera bug. #35 @cadorn - Fixed ``Q.all([])`` #32 @domenic ## 0.8.0 - WARNING: ``enqueue`` removed. Use ``nextTick`` instead. This is more consistent with NodeJS and (subjectively) more explicit and intuitive. - WARNING: ``def`` removed. Use ``master`` instead. The term ``def`` was too confusing to new users. - WARNING: ``spy`` removed in favor of ``fin``. - WARNING: ``wait`` removed. Do ``all(args).get(0)`` instead. - WARNING: ``join`` removed. Do ``all(args).spread(callback)`` instead. - WARNING: Removed the ``Q`` function module.exports alias for ``Q.ref``. It conflicts with ``Q.apply`` in weird ways, making it uncallable. - Revised ``delay`` so that it accepts both ``(value, timeout)`` and ``(timeout)`` variations based on arguments length. - Added ``ref().spread(cb(...args))``, a variant of ``then`` that spreads an array across multiple arguments. Useful with ``all()``. - 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 with ``spread``. - Added ``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. ## 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 ``report`` and ``asap`` - WARNING: The ``callback`` 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. - IMPORTANT: Fixed a bug in the use of ``MessageChannel`` for ``nextTick``. - Renamed ``enqueue`` to ``nextTick``. - Added experimental ``view`` and ``viewInfo`` for 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 ``spy`` and the name ``fin`` were useful. I've removed the old ``fin`` implementation and renamed/aliased ``spy``. - The "q" module now exports its ``ref`` function as a "Q" constructor, with module systems that support exports assignment including NodeJS, RequireJS, and when used as a ``