From f9622e5913e9882482c0cc0f67aa28cbaaf6e4dc Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 10 May 2016 20:23:18 +0300 Subject: [PATCH] feature(bower) promise-polyfill v5.1.0 --- bower.json | 2 +- modules/promise-polyfill/.bower.json | 10 +++++----- modules/promise-polyfill/README.md | 7 ++----- modules/promise-polyfill/package.json | 2 +- modules/promise-polyfill/promise.js | 2 +- modules/promise-polyfill/promise.min.js | 2 +- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/bower.json b/bower.json index ec77e313..ff86353f 100644 --- a/bower.json +++ b/bower.json @@ -40,6 +40,6 @@ "philip": "~1.3.2", "menu": "~1.0.2", "smalltalk": "~1.6.7", - "promise-polyfill": "~5.0.0" + "promise-polyfill": "^5.1.0" } } diff --git a/modules/promise-polyfill/.bower.json b/modules/promise-polyfill/.bower.json index ed9a7419..695505d6 100644 --- a/modules/promise-polyfill/.bower.json +++ b/modules/promise-polyfill/.bower.json @@ -1,6 +1,6 @@ { "name": "promise-polyfill", - "version": "5.0.0", + "version": "5.1.0", "homepage": "https://github.com/taylorhakes/promise-polyfill", "authors": [ "Taylor Hakes" @@ -25,14 +25,14 @@ "test", "tests" ], - "_release": "5.0.0", + "_release": "5.1.0", "_resolution": { "type": "version", - "tag": "5.0.0", - "commit": "3f3aa069529aa240e4d76b30a1ceced5b9c6ec8a" + "tag": "5.1.0", + "commit": "b47cf56bfdc62e71f379fbdc8932f5c9d4b9bc54" }, "_source": "https://github.com/taylorhakes/promise-polyfill.git", - "_target": "~5.0.0", + "_target": "^5.1.0", "_originalSource": "promise-polyfill", "_direct": true } \ No newline at end of file diff --git a/modules/promise-polyfill/README.md b/modules/promise-polyfill/README.md index f6e25c22..d2fa1c45 100644 --- a/modules/promise-polyfill/README.md +++ b/modules/promise-polyfill/README.md @@ -11,8 +11,6 @@ Lightweight ES6 Promise polyfill for the browser and node. Adheres closely to the spec. It is a perfect polyfill IE, Firefox or any other browser that does not support native promises. -This implementation is based on [then/promise](https://github.com/then/promise). It has been changed to use the prototype for performance and memory reasons. - For API information about Promises, please check out this article [HTML5Rocks article](http://www.html5rocks.com/en/tutorials/es6/promises/). It is extremely lightweight. ***< 1kb Gzipped*** @@ -46,9 +44,8 @@ var prom = new Promise(function(resolve, reject) { } }); -// Do something when async done -prom.then(function() { - ... +prom.then(function(result) { + // Do something when async done }); ``` diff --git a/modules/promise-polyfill/package.json b/modules/promise-polyfill/package.json index 487290b3..0c081504 100644 --- a/modules/promise-polyfill/package.json +++ b/modules/promise-polyfill/package.json @@ -1,6 +1,6 @@ { "name": "promise-polyfill", - "version": "5.0.0", + "version": "5.1.0", "description": "Lightweight promise polyfill. A+ compliant", "main": "promise.js", "scripts": { diff --git a/modules/promise-polyfill/promise.js b/modules/promise-polyfill/promise.js index c34cce14..c64b4fdc 100644 --- a/modules/promise-polyfill/promise.js +++ b/modules/promise-polyfill/promise.js @@ -95,7 +95,7 @@ function finale(self) { if (self._state === 2 && self._deferreds.length === 0) { - setTimeout(function() { + asap(function() { if (!self._handled) { onUnhandledRejection(self._value); } diff --git a/modules/promise-polyfill/promise.min.js b/modules/promise-polyfill/promise.min.js index 457d33f6..341f8d89 100644 --- a/modules/promise-polyfill/promise.min.js +++ b/modules/promise-polyfill/promise.min.js @@ -1 +1 @@ -!function(e){function t(){}function n(e,t){return function(){e.apply(t,arguments)}}function o(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],s(e,this)}function i(e,t){for(;3===e._state;)e=e._value;return 0===e._state?void e._deferreds.push(t):(e._handled=!0,void a(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null===n)return void(1===e._state?r:f)(t.promise,e._value);var o;try{o=n(e._value)}catch(i){return void f(t.promise,i)}r(t.promise,o)}))}function r(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var i=t.then;if(t instanceof o)return e._state=3,e._value=t,void u(e);if("function"==typeof i)return void s(n(i,t),e)}e._state=1,e._value=t,u(e)}catch(r){f(e,r)}}function f(e,t){e._state=2,e._value=t,u(e)}function u(e){2===e._state&&0===e._deferreds.length&&setTimeout(function(){e._handled||d(e._value)},1);for(var t=0,n=e._deferreds.length;n>t;t++)i(e,e._deferreds[t]);e._deferreds=null}function c(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}function s(e,t){var n=!1;try{e(function(e){n||(n=!0,r(t,e))},function(e){n||(n=!0,f(t,e))})}catch(o){if(n)return;n=!0,f(t,o)}}var l=setTimeout,a="function"==typeof setImmediate&&setImmediate||function(e){l(e,1)},d=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};o.prototype["catch"]=function(e){return this.then(null,e)},o.prototype.then=function(e,n){var r=new o(t);return i(this,new c(e,n,r)),r},o.all=function(e){var t=Array.prototype.slice.call(e);return new o(function(e,n){function o(r,f){try{if(f&&("object"==typeof f||"function"==typeof f)){var u=f.then;if("function"==typeof u)return void u.call(f,function(e){o(r,e)},n)}t[r]=f,0===--i&&e(t)}catch(c){n(c)}}if(0===t.length)return e([]);for(var i=t.length,r=0;ro;o++)e[o].then(t,n)})},o._setImmediateFn=function(e){a=e},o._setUnhandledRejectionFn=function(e){d=e},"undefined"!=typeof module&&module.exports?module.exports=o:e.Promise||(e.Promise=o)}(this); \ No newline at end of file +!function(e){function t(){}function n(e,t){return function(){e.apply(t,arguments)}}function o(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],s(e,this)}function r(e,t){for(;3===e._state;)e=e._value;return 0===e._state?void e._deferreds.push(t):(e._handled=!0,void a(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null===n)return void(1===e._state?i:f)(t.promise,e._value);var o;try{o=n(e._value)}catch(r){return void f(t.promise,r)}i(t.promise,o)}))}function i(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var r=t.then;if(t instanceof o)return e._state=3,e._value=t,void u(e);if("function"==typeof r)return void s(n(r,t),e)}e._state=1,e._value=t,u(e)}catch(i){f(e,i)}}function f(e,t){e._state=2,e._value=t,u(e)}function u(e){2===e._state&&0===e._deferreds.length&&a(function(){e._handled||d(e._value)},1);for(var t=0,n=e._deferreds.length;n>t;t++)r(e,e._deferreds[t]);e._deferreds=null}function c(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}function s(e,t){var n=!1;try{e(function(e){n||(n=!0,i(t,e))},function(e){n||(n=!0,f(t,e))})}catch(o){if(n)return;n=!0,f(t,o)}}var l=setTimeout,a="function"==typeof setImmediate&&setImmediate||function(e){l(e,1)},d=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};o.prototype["catch"]=function(e){return this.then(null,e)},o.prototype.then=function(e,n){var i=new o(t);return r(this,new c(e,n,i)),i},o.all=function(e){var t=Array.prototype.slice.call(e);return new o(function(e,n){function o(i,f){try{if(f&&("object"==typeof f||"function"==typeof f)){var u=f.then;if("function"==typeof u)return void u.call(f,function(e){o(i,e)},n)}t[i]=f,0===--r&&e(t)}catch(c){n(c)}}if(0===t.length)return e([]);for(var r=t.length,i=0;io;o++)e[o].then(t,n)})},o._setImmediateFn=function(e){a=e},o._setUnhandledRejectionFn=function(e){d=e},"undefined"!=typeof module&&module.exports?module.exports=o:e.Promise||(e.Promise=o)}(this); \ No newline at end of file