Comparing version 2.4.0 to 2.5.0
@@ -111,3 +111,3 @@ /** @license MIT License (c) copyright 2013 original author or authors */ | ||
* | ||
* If additional arguments are passed to the `bind` call, they will be prepended | ||
* If additional arguments are passed to the `lift` call, they will be prepended | ||
* on the calls to the original function, much like `Function.prototype.bind`. | ||
@@ -129,6 +129,6 @@ * | ||
* | ||
* var promiseAjax = callbacks.bind(traditionalAjax); | ||
* var promiseAjax = callbacks.lift(traditionalAjax); | ||
* promiseAjax("GET", "/movies.json").then(console.log, console.error); | ||
* | ||
* var promiseAjaxGet = callbacks.bind(traditionalAjax, "GET"); | ||
* var promiseAjaxGet = callbacks.lift(traditionalAjax, "GET"); | ||
* promiseAjaxGet("/movies.json").then(console.log, console.error); | ||
@@ -148,3 +148,3 @@ * | ||
/** | ||
* `promisify` is a version of `bind` that allows fine-grained control over the | ||
* `promisify` is a version of `lift` that allows fine-grained control over the | ||
* arguments that passed to the underlying function. It is intended to handle | ||
@@ -151,0 +151,0 @@ * functions that don't follow the common callback and errback positions. |
@@ -52,7 +52,2 @@ /** @license MIT License (c) copyright B Cavalier & J Hann */ | ||
// Also replace deferred.then to allow it to be called safely and | ||
// observe the cancellation | ||
// TODO: Remove once deferred.then is removed | ||
deferred.then = delegate.promise.then; | ||
return deferred; | ||
@@ -59,0 +54,0 @@ }; |
@@ -0,1 +1,10 @@ | ||
### 2.5.0 | ||
* [Promises/A+ 1.1](http://promisesaplus.com) compliant. Passes version 2.0.0 of the [Promises/A+ test suite](https://github.com/promises-aplus/promises-tests). | ||
### 2.4.1 | ||
* New `MutationObserver` scheduler further reduces "time-to-first-handler" in modern browsers. (#198) | ||
* Also, this works around a horrible IE10 bug (desktop and mobile) that renders `setImmediate`, `MessageChannel`, and `postMessage` unusable as fast task schedulers. Many thanks to @plaa and @calvinmetcalf for their help in discovering the problem and working out a solution. (#197) | ||
### 2.4.0 | ||
@@ -2,0 +11,0 @@ |
@@ -124,3 +124,3 @@ /** @license MIT License (c) copyright 2013 original author or authors */ | ||
* | ||
* var promiseRead = nodefn.bind(fs.readFile); | ||
* var promiseRead = nodefn.lift(fs.readFile); | ||
* | ||
@@ -127,0 +127,0 @@ * // The promise is resolved with the contents of the file if everything |
{ | ||
"name": "when", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"description": "A lightweight Promises/A+ and when() implementation, plus other async goodies.", | ||
@@ -44,3 +44,3 @@ "keywords": ["Promises/A+", "promises-aplus", "promise", "promises", "deferred", "deferreds", "when", "async", "asynchronous", "cujo"], | ||
"test-support": "~0.3", | ||
"promises-aplus-tests": "~1", | ||
"promises-aplus-tests": "~2", | ||
"benchmark": "~1", | ||
@@ -54,3 +54,3 @@ "microtime": "~0" | ||
"scripts": { | ||
"test": "jshint . && buster test -e node -r specification && promises-aplus-tests test/promises-aplus-adapter.js", | ||
"test": "jshint . && buster test -e node -r specification && promises-aplus-tests test/promises-aplus-adapter.js --reporter spec", | ||
"ci": "npm test && sauceme", | ||
@@ -57,0 +57,0 @@ "tunnel": "sauceme -m", |
@@ -18,2 +18,11 @@ <a href="http://promises-aplus.github.com/promises-spec"><img src="http://promises-aplus.github.com/promises-spec/assets/logo-small.png" alt="Promises/A+ logo" align="right" /></a> | ||
### 2.5.0 | ||
* [Promises/A+ 1.1](http://promisesaplus.com) compliant. Passes version 2.0.0 of the [Promises/A+ test suite](https://github.com/promises-aplus/promises-tests). | ||
### 2.4.1 | ||
* New `MutationObserver` scheduler further reduces "time-to-first-handler" in modern browsers. (#198) | ||
* Also, this works around a horrible IE10 bug (desktop and mobile) that renders `setImmediate`, `MessageChannel`, and `postMessage` unusable as fast task schedulers. Many thanks to @plaa and @calvinmetcalf for their help in discovering the problem and working out a solution. (#197) | ||
### 2.4.0 | ||
@@ -20,0 +29,0 @@ |
39
when.js
@@ -12,3 +12,3 @@ /** @license MIT License (c) copyright 2011-2013 original author or authors */ | ||
* @author John Hann | ||
* @version 2.4.0 | ||
* @version 2.5.0 | ||
*/ | ||
@@ -325,3 +325,3 @@ (function(define, global) { 'use strict'; | ||
value = coerce(val); | ||
value = coerce(self, val); | ||
scheduleConsumers(consumers, value); | ||
@@ -426,3 +426,7 @@ consumers = undef; | ||
*/ | ||
function coerce(x) { | ||
function coerce(self, x) { | ||
if (x === self) { | ||
return rejected(new TypeError()); | ||
} | ||
if (x instanceof Promise) { | ||
@@ -707,3 +711,2 @@ return x; | ||
results[i] = mapped; | ||
notify(mapped); | ||
@@ -713,3 +716,3 @@ if(!--toResolve) { | ||
} | ||
}, reject); | ||
}, reject, notify); | ||
} | ||
@@ -792,3 +795,3 @@ } | ||
setTimeout, funcProto, call, arrayProto, monitorApi, | ||
cjsRequire, undef; | ||
cjsRequire, MutationObserver, undef; | ||
@@ -839,13 +842,17 @@ cjsRequire = require; | ||
// Prefer setImmediate or MessageChannel, cascade to node, | ||
// vertx and finally setTimeout | ||
/*global setImmediate,MessageChannel,process*/ | ||
if (typeof setImmediate === 'function') { | ||
nextTick = setImmediate.bind(global); | ||
} else if(typeof MessageChannel !== 'undefined') { | ||
var channel = new MessageChannel(); | ||
channel.port1.onmessage = drainQueue; | ||
nextTick = function() { channel.port2.postMessage(0); }; | ||
} else if (typeof process === 'object' && process.nextTick) { | ||
// Sniff "best" async scheduling option | ||
// Prefer process.nextTick or MutationObserver, then check for | ||
// vertx and finally fall back to setTimeout | ||
/*global process*/ | ||
if (typeof process === 'object' && process.nextTick) { | ||
nextTick = process.nextTick; | ||
} else if(MutationObserver = global.MutationObserver || global.WebKitMutationObserver) { | ||
nextTick = (function(document, MutationObserver, drainQueue) { | ||
var el = document.createElement('div'); | ||
new MutationObserver(drainQueue).observe(el, { attributes: true }); | ||
return function() { | ||
el.setAttribute('x', 'x'); | ||
}; | ||
}(document, MutationObserver, drainQueue)); | ||
} else { | ||
@@ -852,0 +859,0 @@ try { |
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
127621
3195
158