feature(bower) promise-polyfill v5.0.0

This commit is contained in:
coderaiser 2016-05-04 18:27:33 +03:00
parent 0d272342f2
commit efaec030e6
8 changed files with 23 additions and 25 deletions

View file

@ -40,6 +40,6 @@
"philip": "~1.3.2",
"menu": "~1.0.2",
"smalltalk": "~1.6.7",
"promise-polyfill": "~4.0.1"
"promise-polyfill": "~5.0.0"
}
}

View file

@ -1,12 +1,12 @@
{
"name": "promise-polyfill",
"version": "4.0.1",
"version": "5.0.0",
"homepage": "https://github.com/taylorhakes/promise-polyfill",
"authors": [
"Taylor Hakes"
],
"description": "Lightweight promise polyfill for the browser and node. A+ Compliant.",
"main": "Promise.js",
"main": "promise.js",
"moduleType": [
"globals",
"node"
@ -25,14 +25,14 @@
"test",
"tests"
],
"_release": "4.0.1",
"_release": "5.0.0",
"_resolution": {
"type": "version",
"tag": "4.0.1",
"commit": "c381e1fd30a9a6ae3e1055aaef58859e45fa8270"
"tag": "5.0.0",
"commit": "3f3aa069529aa240e4d76b30a1ceced5b9c6ec8a"
},
"_source": "git://github.com/taylorhakes/promise-polyfill.git",
"_target": "~4.0.1",
"_source": "https://github.com/taylorhakes/promise-polyfill.git",
"_target": "~5.0.0",
"_originalSource": "promise-polyfill",
"_direct": true
}

View file

@ -22,8 +22,8 @@ IE8+, Chrome, Firefox, IOS 4+, Safari 5+, Opera
## Downloads
- [Promise](https://raw.github.com/taylorhakes/promise-polyfill/master/Promise.js)
- [Promise-min](https://raw.github.com/taylorhakes/promise-polyfill/master/Promise.min.js)
- [Promise](https://raw.github.com/taylorhakes/promise-polyfill/master/promise.js)
- [Promise-min](https://raw.github.com/taylorhakes/promise-polyfill/master/promise.min.js)
### Node
```
@ -35,7 +35,7 @@ bower install promise-polyfill
```
## Simple use
```
```js
var prom = new Promise(function(resolve, reject) {
// do a thing, possibly async, then…
@ -63,7 +63,7 @@ npm install setasap --save
```js
var Promise = require('promise-polyfill');
var setAsap = require('setasap');
Promise._setImmedateFn(setAsap);
Promise._setImmediateFn(setAsap);
```
## Unhandled Rejections

View file

@ -6,7 +6,7 @@
"Taylor Hakes"
],
"description": "Lightweight promise polyfill for the browser and node. A+ Compliant.",
"main": "Promise.js",
"main": "promise.js",
"moduleType": [
"globals",
"node"

View file

@ -15,7 +15,7 @@ module.exports = function (config) {
// list of files / patterns to load in the browser
files: [
'test/Promise.js'
'test/promise.js'
],
@ -26,7 +26,7 @@ module.exports = function (config) {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'test/Promise.js': ['browserify']
'test/promise.js': ['browserify']
},

View file

@ -1,8 +1,8 @@
{
"name": "promise-polyfill",
"version": "4.0.1",
"version": "5.0.0",
"description": "Lightweight promise polyfill. A+ compliant",
"main": "Promise.js",
"main": "promise.js",
"scripts": {
"test": "eslint promise.js && mocha && karma start --single-run",
"build": "uglifyjs --compress --mangle -o promise.min.js -- promise.js "

View file

@ -14,7 +14,9 @@
};
var onUnhandledRejection = function onUnhandledRejection(err) {
console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
if (typeof console !== 'undefined' && console) {
console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
}
};
// Polyfill for Function.prototype.bind
@ -24,10 +26,6 @@
};
}
var isArray = Array.isArray || function (value) {
return Object.prototype.toString.call(value) === '[object Array]';
};
function Promise(fn) {
if (typeof this !== 'object') throw new TypeError('Promises must be constructed via new');
if (typeof fn !== 'function') throw new TypeError('not a function');
@ -151,8 +149,8 @@
return prom;
};
Promise.all = function () {
var args = Array.prototype.slice.call(arguments.length === 1 && isArray(arguments[0]) ? arguments[0] : arguments);
Promise.all = function (arr) {
var args = Array.prototype.slice.call(arr);
return new Promise(function (resolve, reject) {
if (args.length === 0) return resolve([]);

View file

@ -1 +1 @@
!function(t){function e(){}function n(t,e){return function(){t.apply(e,arguments)}}function o(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],a(t,this)}function r(t,e){for(;3===t._state;)t=t._value;return 0===t._state?void t._deferreds.push(e):(t._handled=!0,void l(function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null===n)return void(1===t._state?i:u)(e.promise,t._value);var o;try{o=n(t._value)}catch(r){return void u(e.promise,r)}i(e.promise,o)}))}function i(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var r=e.then;if(e instanceof o)return t._state=3,t._value=e,void f(t);if("function"==typeof r)return void a(n(r,e),t)}t._state=1,t._value=e,f(t)}catch(i){u(t,i)}}function u(t,e){t._state=2,t._value=e,f(t)}function f(t){2===t._state&&0===t._deferreds.length&&setTimeout(function(){t._handled||o._onUnhandledRejection(t._value)},1);for(var e=0,n=t._deferreds.length;n>e;e++)r(t,t._deferreds[e]);t._deferreds=null}function c(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function a(t,e){var n=!1;try{t(function(t){n||(n=!0,i(e,t))},function(t){n||(n=!0,u(e,t))})}catch(o){if(n)return;n=!0,u(e,o)}}var s=setTimeout,l="function"==typeof setImmediate&&setImmediate||function(t){s(t,1)},d=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};o.prototype["catch"]=function(t){return this.then(null,t)},o.prototype.then=function(t,n){var i=new o(e);return r(this,new c(t,n,i)),i},o.all=function(){var t=Array.prototype.slice.call(1===arguments.length&&d(arguments[0])?arguments[0]:arguments);return new o(function(e,n){function o(i,u){try{if(u&&("object"==typeof u||"function"==typeof u)){var f=u.then;if("function"==typeof f)return void f.call(u,function(t){o(i,t)},n)}t[i]=u,0===--r&&e(t)}catch(c){n(c)}}if(0===t.length)return e([]);for(var r=t.length,i=0;i<t.length;i++)o(i,t[i])})},o.resolve=function(t){return t&&"object"==typeof t&&t.constructor===o?t:new o(function(e){e(t)})},o.reject=function(t){return new o(function(e,n){n(t)})},o.race=function(t){return new o(function(e,n){for(var o=0,r=t.length;r>o;o++)t[o].then(e,n)})},o._setImmediateFn=function(t){l=t},o._onUnhandledRejection=function(t){console.warn("Possible Unhandled Promise Rejection:",t)},"undefined"!=typeof module&&module.exports?module.exports=o:t.Promise||(t.Promise=o)}(this);
!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;r<t.length;r++)o(r,t[r])})},o.resolve=function(e){return e&&"object"==typeof e&&e.constructor===o?e:new o(function(t){t(e)})},o.reject=function(e){return new o(function(t,n){n(e)})},o.race=function(e){return new o(function(t,n){for(var o=0,i=e.length;i>o;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);