Comparing version 0.0.11 to 0.0.12
2
p.js
@@ -7,3 +7,3 @@ ;(function( factory ){ | ||
// RequireJS | ||
} else if ( typeof define === "function" ) { | ||
} else if ( typeof define === "function" && define.amd ) { | ||
define( factory ); | ||
@@ -10,0 +10,0 @@ |
@@ -1,1 +0,1 @@ | ||
(function(e){if(typeof module!=="undefined"&&module&&module.exports){module.exports=e()}else if(typeof define==="function"){define(e)}else{P=e()}})(function(){"use strict";var e={f:null,w:false,n:null},n=e,t=true,r=0,o=0,i,f,u=v(typeof window)&&window||v(typeof worker)&&worker,c=e.toString,l,s={};function a(){--r;if(e.n){if(!r&&e.n.n){++r;f(a,0)}do{e=e.n;if(e.w){--o}var n=e.f;e.f=null;n()}while(e.n)}t=true}function p(e,i){if(t&&++o>r){++r;f(a,0)}n=n.n={f:e,w:t,n:null};t=i===true}function v(e){return e==="object"||e==="function"}function m(e){return e==="function"}if(v(typeof process)&&process&&m(typeof process.nextTick)){f=process.nextTick}else if(u&&m(typeof u.setImmediate)){f=function(e){u.setImmediate(e)}}else if(m(typeof MessageChannel)){i=new MessageChannel;i.port1.onmessage=a;f=function(){i.port2.postMessage(0)}}else{f=setTimeout;if(u&&v(typeof Image)&&Image){(function(){var e=0;var n=function(e){var n=new Image;n.onerror=e;n.src="data:image/png,"};try{n(function(){if(--e===0){f=n}});++e}catch(t){}e&&setTimeout(function(){e=0},0)})()}}l=Array.isArray||function(e){return!!e&&c.call(e)==="[object Array]"};function h(e,n){for(var t=0,r=e.length;t<r;++t){if(t in e){n(e[t],t)}}}function d(e,n){if(l(e)){h(e,n);return}for(var t in e){n(e[t],t)}}function y(e){if(e instanceof g){return e}var n=w();n.resolve(e);return n.promise}y.defer=w;function w(){var e=[],n=false,t=new g(o),r;function o(t,o,i,f){var u=i===s?f:w();function c(){var e=n?o:t;if(!u){e&&e(r);return}if(typeof e==="function"){try{var i=e(r)}catch(f){u.reject(f)}u.resolve(i)}else if(n){u.reject(r)}else{u.fulfill(r)}}if(e){e.push(c)}else{p(c)}return u&&u.promise}function i(n){if(e){if(n instanceof g){n.then(f,u,s)}else if(n&&typeof n.then==="function"){p(function(){try{n.then(f,u)}catch(e){u(e)}})}else{f(n)}}}function f(o){if(e){t.state=n?"rejected":"fulfilled";t.value=r=o;h(e,p);e=null}}function u(t){if(e){n=true;f(t)}}return{promise:t,resolve:i,fulfill:f,reject:u}}function g(e){this.then=e;this.state="pending";this.value=void 0}g.prototype.done=function(e,n){var t=this;if(e||n){t=t.then(e,n)}t.then(null,function(e){p(function(){if(y.onerror){y.onerror(e)}else{throw e}},true)},s)};g.prototype.spread=function(e,n){return this.then(e&&function(n){return e.apply(void 0,n)},n)};g.prototype.timeout=function(e){var n=w();var t=setTimeout(function(){n.reject(new Error("Timed out after "+e+" ms"))},e);this.when(function(e){clearTimeout(t);n.fulfill(e)},function(e){clearTimeout(t);n.reject(e)},s);return n.promise};g.prototype.delay=function(e){var n=this;var t=w();setTimeout(function(){t.resolve(n)},e);return t.promise};y.all=T;function T(e){var n=0;var t=w();d(e,function(r,o){++n;y(r).then(function(r){e[o]=r;if(--n===0){t.fulfill(e)}},t.reject,s)});if(n===0){t.fulfill(e)}return t.promise}y.allResolved=j;function j(e){var n=1;var t=w();function r(){if(--n===0){t.fulfill(e)}}d(e,function(t,o){++n;e[o]=t=y(t);t.then(r,r,s)});r();return t.promise}y.onerror=null;y.prototype=g.prototype;y.nextTick=function(e){p(e,true)};return y}); | ||
(function(e){if(typeof module!=="undefined"&&module&&module.exports){module.exports=e()}else if(typeof define==="function"&&define.amd){define(e)}else{P=e()}})(function(){"use strict";var e={f:null,w:false,n:null},n=e,t=true,r=0,o=0,i,f,u=m(typeof window)&&window||m(typeof worker)&&worker,c=e.toString,l,s={};function a(){--r;if(e.n){if(!r&&e.n.n){++r;f(a,0)}do{e=e.n;if(e.w){--o}var n=e.f;e.f=null;n()}while(e.n)}t=true}function p(e,i){if(t&&++o>r){++r;f(a,0)}n=n.n={f:e,w:t,n:null};t=i===true}function m(e){return e==="object"||e==="function"}function v(e){return e==="function"}if(m(typeof process)&&process&&v(typeof process.nextTick)){f=process.nextTick}else if(u&&v(typeof u.setImmediate)){f=function(e){u.setImmediate(e)}}else if(v(typeof MessageChannel)){i=new MessageChannel;i.port1.onmessage=a;f=function(){i.port2.postMessage(0)}}else{f=setTimeout;if(u&&m(typeof Image)&&Image){(function(){var e=0;var n=function(e){var n=new Image;n.onerror=e;n.src="data:image/png,"};try{n(function(){if(--e===0){f=n}});++e}catch(t){}e&&setTimeout(function(){e=0},0)})()}}l=Array.isArray||function(e){return!!e&&c.call(e)==="[object Array]"};function d(e,n){for(var t=0,r=e.length;t<r;++t){if(t in e){n(e[t],t)}}}function h(e,n){if(l(e)){d(e,n);return}for(var t in e){n(e[t],t)}}function y(e){if(e instanceof g){return e}var n=w();n.resolve(e);return n.promise}y.defer=w;function w(){var e=[],n=false,t=new g(o),r;function o(t,o,i,f){var u=i===s?f:w();function c(){var e=n?o:t;if(!u){e&&e(r);return}if(typeof e==="function"){try{var i=e(r)}catch(f){u.reject(f)}u.resolve(i)}else if(n){u.reject(r)}else{u.fulfill(r)}}if(e){e.push(c)}else{p(c)}return u&&u.promise}function i(n){if(e){if(n instanceof g){n.then(f,u,s)}else if(n&&typeof n.then==="function"){p(function(){try{n.then(f,u)}catch(e){u(e)}})}else{f(n)}}}function f(o){if(e){t.state=n?"rejected":"fulfilled";t.value=r=o;d(e,p);e=null}}function u(t){if(e){n=true;f(t)}}return{promise:t,resolve:i,fulfill:f,reject:u}}function g(e){this.then=e;this.state="pending";this.value=void 0}g.prototype.done=function(e,n){var t=this;if(e||n){t=t.then(e,n)}t.then(null,function(e){p(function(){if(y.onerror){y.onerror(e)}else{throw e}},true)},s)};g.prototype.spread=function(e,n){return this.then(e&&function(n){return e.apply(void 0,n)},n)};g.prototype.timeout=function(e){var n=w();var t=setTimeout(function(){n.reject(new Error("Timed out after "+e+" ms"))},e);this.when(function(e){clearTimeout(t);n.fulfill(e)},function(e){clearTimeout(t);n.reject(e)},s);return n.promise};g.prototype.delay=function(e){var n=this;var t=w();setTimeout(function(){t.resolve(n)},e);return t.promise};y.all=T;function T(e){var n=0;var t=w();h(e,function(r,o){++n;y(r).then(function(r){e[o]=r;if(--n===0){t.fulfill(e)}},t.reject,s)});if(n===0){t.fulfill(e)}return t.promise}y.allResolved=j;function j(e){var n=1;var t=w();function r(){if(--n===0){t.fulfill(e)}}h(e,function(t,o){++n;e[o]=t=y(t);t.then(r,r,s)});r();return t.promise}y.onerror=null;y.prototype=g.prototype;y.nextTick=function(e){p(e,true)};return y}); |
{ | ||
"name": "p-promise", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "A simple Promises/A+ library.", | ||
@@ -5,0 +5,0 @@ "author": "Robert Katić <robert.katic@gmail.com> (https://github.com/rkatic)", |
12499