Comparing version 2.0.1 to 2.0.2
# master | ||
# 2.0.2 | ||
* Adding RSVP#rethrow | ||
* add pre-built AMD link to README | ||
* adding promise#fail | ||
# 2.0.1 | ||
* misc IE fixes, including IE array detection | ||
* upload passing builds to s3 | ||
* async: use three args for addEventListener | ||
* satisfy both 1.0 and 1.1 specs | ||
* Run reduce tests only in node | ||
* RSVP.resolve now simply uses the internal resolution procedure | ||
* prevent multiple promise resolutions | ||
* simplify thenable handling | ||
* pre-allocate the deferred's shape | ||
* Moved from Rake-based builds to Grunt | ||
* Fix Promise subclassing bug | ||
* Add RSVP.configure('onerror') | ||
* Throw exception when RSVP.all is called without an array | ||
* refactor RSVP.all to just use a promise directly | ||
* Make `RSVP.denodeify` pass along `thisArg` | ||
* add RSVP.reject | ||
* Reject promise if resolver function throws an exception | ||
* add travis build-status | ||
* correctly test and fix self fulfillment | ||
* remove promise coercion. | ||
* Fix infinite recursion with deep self fulfilling promises | ||
* doc fixes | ||
# 2.0.0 | ||
* No changelog beyond this point. Here be dragons. |
@@ -7,2 +7,3 @@ "use strict"; | ||
var hash = require("./rsvp/hash").hash; | ||
var rethrow = require("./rsvp/rethrow").rethrow; | ||
var defer = require("./rsvp/defer").defer; | ||
@@ -22,2 +23,3 @@ var config = require("./rsvp/config").config; | ||
exports.hash = hash; | ||
exports.rethrow = rethrow; | ||
exports.defer = defer; | ||
@@ -24,0 +26,0 @@ exports.denodeify = denodeify; |
@@ -55,3 +55,3 @@ "use strict"; | ||
return function(callback, arg) { | ||
setTimeout(function() { | ||
global.setTimeout(function() { | ||
callback(arg); | ||
@@ -58,0 +58,0 @@ }, 1); |
@@ -124,2 +124,6 @@ "use strict"; | ||
return thenPromise; | ||
}, | ||
fail: function(fail) { | ||
return this.then(null, fail); | ||
} | ||
@@ -126,0 +130,0 @@ }; |
@@ -6,2 +6,3 @@ import { EventTarget } from "./rsvp/events"; | ||
import { hash } from "./rsvp/hash"; | ||
import { rethrow } from "./rsvp/rethrow"; | ||
import { defer } from "./rsvp/defer"; | ||
@@ -16,2 +17,2 @@ import { config } from "./rsvp/config"; | ||
export { Promise, EventTarget, all, hash, defer, denodeify, configure, resolve, reject }; | ||
export { Promise, EventTarget, all, hash, rethrow, defer, denodeify, configure, resolve, reject }; |
@@ -54,3 +54,3 @@ var browserGlobal = (typeof window !== 'undefined') ? window : {}; | ||
return function(callback, arg) { | ||
setTimeout(function() { | ||
global.setTimeout(function() { | ||
callback(arg); | ||
@@ -57,0 +57,0 @@ }, 1); |
@@ -123,2 +123,6 @@ import { config } from "./config"; | ||
return thenPromise; | ||
}, | ||
fail: function(fail) { | ||
return this.then(null, fail); | ||
} | ||
@@ -125,0 +129,0 @@ }; |
{ | ||
"name": "rsvp", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "A lightweight library that provides tools for organizing asynchronous code", | ||
@@ -5,0 +5,0 @@ "main": "dist/commonjs/main.js", |
@@ -14,2 +14,3 @@ # RSVP.js [![Build Status](https://secure.travis-ci.org/tildeio/rsvp.js.png?branch=master)](http://travis-ci.org/tildeio/rsvp.js) | ||
- [rsvp-latest](http://rsvpjs-builds.s3.amazonaws.com/rsvp-latest.js) | ||
- [rsvp-latest (amd)](http://rsvpjs-builds.s3.amazonaws.com/rsvp-latest.amd.js) | ||
@@ -140,2 +141,13 @@ ## Promises | ||
You can also use `fail` for error handling, which is a shortcut for | ||
`then(null, rejection)`, like so: | ||
```javascript | ||
getJSON("/post/1.json").then(function(post) { | ||
return getJSON(post.commentURL); | ||
}).fail(function(error) { | ||
// handle errors | ||
}); | ||
``` | ||
## Arrays of promises | ||
@@ -142,0 +154,0 @@ |
/*global describe, specify, it, assert */ | ||
var local = (typeof global === "undefined") ? this : global; | ||
if (typeof Object.getPrototypeOf !== "function") { | ||
@@ -727,2 +729,43 @@ Object.getPrototypeOf = "".__proto__ === String.prototype | ||
describe("RSVP.rethrow", function() { | ||
var onerror, oldSetTimeout = global.setTimeout; | ||
after(function() { | ||
global.setTimeout = oldSetTimeout; | ||
}); | ||
it("should exist", function() { | ||
assert(RSVP.rethrow); | ||
}); | ||
it("rethrows an error", function(done) { | ||
var thrownError = new Error('I am an error.'); | ||
local.setTimeout = function (callback) { | ||
done(); | ||
var errorWasThrown = false; | ||
try { | ||
callback.call(this, arguments); | ||
} catch(e) { | ||
errorWasThrown = true; | ||
} | ||
assert(errorWasThrown, 'expect that an error was thrown'); | ||
}; | ||
function expectRejection(reason) { | ||
assertEqual(reason, thrownError); | ||
} | ||
function doNotExpectFulfillment(value) { | ||
done(); | ||
assert(false, value); | ||
} | ||
RSVP.reject(thrownError). | ||
fail(RSVP.rethrow). | ||
then(doNotExpectFulfillment, expectRejection); | ||
}); | ||
}); | ||
describe("RSVP.resolve", function(){ | ||
@@ -729,0 +772,0 @@ specify("it should exist", function(){ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
226801
46
7474
274