-
Notifications
You must be signed in to change notification settings - Fork 390
Changelog
Brian Cavalier edited this page Dec 7, 2012
·
24 revisions
- Removed leftover internal usages of
deferred.then. - when/debug allows configuring the set of "fatal" error types that will be rethrown to the host env.
-
DEPRECATED:
deferred.thenis deprecated and will be removed in an upcoming release. Usedeferred.promise.theninstead. - promise.yield(promiseOrValue) convenience API for substituting a new value into a promise chain.
- promise.spread(variadicFunction) convenience API for spreading an array onto a fulfill handler that accepts variadic arguments. Mmmm, buttery
- Doc improvements:
- when() and promise.then() have more info about callbacks and chaining behavior.
- More info and clarifications about the roles of Deferred and Resolver
- Several minor clarifications for various APIs
- Internal improvements to assimilation and interoperability with other promise implementations.
- Fix for accidental coercion of non-promises. See #62.
- New when.join - Joins 2 or more promises together into a single promise.
- when.some and when.any now act like competitive races, and have generally more useful behavior. Read the discussion in #60.
- Experimental progress event propagation. Progress events will propagate through promise chains. Read the details here.
-
Temporarily removed calls to
Object.freeze. Promises are no longer frozen due to a horrendous v8 performance penalty. Read discussion here.-
IMPORTANT: Continue to treat promises as if they are frozen, since
freeze()will be reintroduced once v8 performance improves.
-
IMPORTANT: Continue to treat promises as if they are frozen, since
- when/debug now allows setting global a debugging callback for rejected promises.
- Integrate @domenic's Promises/A Test Suite. Runs via
npm test. - No functional change
- Performance optimization for when.defer, up to 1.5x in some cases.
- when/debug can now log exceptions and rejections in deeper promise chains, in some cases, even when the promises involved aren't when.js promises.
- New task execution and concurrency management: when/sequence, when/pipeline, and when/parallel.
- Performance optimizations for when.all and when.map, up to 2x in some cases.
- Options for disabling paranoid mode that provides a significant performance gain in v8 (e.g. Node and Chrome). See this v8 performance problem with Object.freeze for more info.
-
Important:
deferredanddeferred.resolverno longer throw when resolved/rejected multiple times. They will return silently as if the they had succeeded. This prevents parties to whom only theresolverhas been given from usingtry/catchto determine the state of the associated promise.- For debugging, you can use the when/debug module, which will still throw when a deferred is resolved/rejected multiple times.
- Change UMD boilerplate to check for
exportsto avoid a problem with QUnit. See #54 for more info.
- Fix for infinite promise coercion between when.js and Q (See #50). Thanks @kriskowal and @domenic
- Fix for IE8 infinite recursion (See #49)
- Code and unit test cleanup and streamlining--no functional changes.
- Create a resolved promise:
when.resolve(value)creates a resolved promise forvalue. See API docs. - Resolve/reject return something useful:
deferred.resolveanddeferred.rejectnow return a promise for the fulfilled or rejected value. - Resolve a deferred with another promise:
deferred.resolve(promise)- whenpromiseresolves or rejects, so willdeferred.
- Fixed a deviation from the Promises/A spec where returning undefined from a callback or errback would cause the previous value to be forwarded. See #31
-
This could be a breaking change if you depended on this behavior. If you encounter problems, the solution is to ensure that your promise callbacks (registered either with
when()or.then()) return what you intend, keeping in mind that not returning something is equivalent to returningundefined.
-
This could be a breaking change if you depended on this behavior. If you encounter problems, the solution is to ensure that your promise callbacks (registered either with
- This change also restores compatibility with the promises returned by
jQuery.get(), which seem to reject with themselves as the rejection value. See issue #41 for more information and discussion. Thanks to @KidkArolis for raising the issue.
-
promise.otherwise(errback)as a shortcut forpromise.then(null, errback). See discussion here and here. Thanks to @jonnyreeves for suggesting the name "otherwise". - when/debug now detects exceptions that typically represent coding errors, such as SyntaxError, ReferenceError, etc. and propagates them to the host environment. In other words, you'll get a very loud stack trace.
- Updated wiki map/reduce examples, and added simple promise forwarding example
- Fix for calling
when.any()without a callback (#33) - Fix version number in
when.jssource (#36)
-
when.all/any/some/map/reducecan all now accept a promise for an array in addition to an actual array as input. This allows composing functions to do interesting things likewhen.reduce(when.map(...)) -
when.reject(promiseOrValue)that returns a new, rejected promise. -
promise.always(callback)as a shortcut forpromise.then(callback, callback) -
Highly experimental when/debug module: a drop-in replacement for the main
whenmodule that enables debug logging for promises created or consumed by when.js
- Travis CI integration
- Fix for cancelable deferred not invoking progress callbacks. (#24 Thanks @scothis)
- The promise returned by
when.chainnow rejects when the input promise rejects.
- Fix for specific situation where
nullcould incorrectly be used as a promise resolution value (#23)
- Updated README for running unit tests in both Node and Browsers. See Running the Unit Tests below.
- Set package name to 'when' in package.json
- Fix for rejections propagating in some cases when they shouldn't have been (#19)
- Using buster.js for unit tests now.
- First official when.js release as a part of cujojs.
- Added when/cancelable decorator for creating cancelable deferreds
- Added when/delay and when/timeout helpers for creating delayed promises and promises that timeout and reject if not resolved first.
- Added when/apply helper module for using arguments-based and variadic callbacks with
when.all,when.some,when.map, or any promise that resolves to an array. (#14) -
.then(),when(), and all other methods that accept callback/errback/progress handlers will throw if you pass something that's not a function. (#15)
-
when.jsnow assimilates thenables that pass the Promises/A duck-type test, but which may not be fully Promises/A compliant, such as jQuery's Deferred and curl's global API (See the API at a glance section)-
when(), andwhen.all/some/any/map/reduce/chain()are all now guaranteed to return a fully Promises/A compliant promise, even when their input is not compliant. - Any non-compliant thenable returned by a callback or errback will also be assimilated to protect subsequent promises and callbacks in a promise chain, and preserve Promises/A forwarding guarantees.
-
-
Important Fix for some AMD build/optimizer tools: Switching back to more verbose, builder-friendly boilerplate
- If you are using when.js 0.10.3 with the dojo or RequireJS build tools, you should update to v.10.4 as soon as possible.
Warning: This version will not work with most AMD build tools. You should update to 0.10.4 as soon as possible.
- Minor
package.jsonupdates - Slightly smaller module boilerplate
- Performance optimizations for
when.map()(thanks @smitranic), especially for large arrays where themapFuncis also async (i.e. returns a promise) -
when.all/some/any/map/reducehandle sparse arrays (thanks @rwaldrn) - Other minor performance optimizations
- Minor tweaks (thanks @johan)
- Add missing semis that WebStorm didn't catch
- Fix DOH submodule ref, and update README with info for running unit tests
-
when.mapandwhen.reduce- just like Array.map and Array.reduce, but they operate on promises and arrays of promises - Lots of internal size and performance optimizations
- Still only 1k!
- Important fix for break in promise chains