Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

v0.6.0

  • Loading branch information...
commit e642bca1e4490f1d2d13eeee89a8d9bfbd4438e9 1 parent 69aae5b
Kris Kowal kriskowal authored

Showing 3 changed files with 15 additions and 16 deletions. Show diff stats Hide diff stats

  1. +3 5 CHANGES
  2. +1 1  package.json
  3. +11 10 q.min.js
8 CHANGES
@@ -4,12 +4,10 @@ Future Backward Incompatible
4 4 - ``def`` will be removed. Use ``master`` instead. The
5 5 term ``def`` was too confusing to new users.
6 6
7   -Next major
8   - - In practice, the implementation of ``spy`` and the
9   - ``name`` ``fin`` were useful. I've removed the old
  7 +0.6.0 - BACKWARD INCOMPATIBILITY
  8 + - WARNING: In practice, the implementation of ``spy`` and
  9 + the ``name`` ``fin`` were useful. I've removed the old
10 10 ``fin`` implementation and renamed/aliased ``spy``.
11   -
12   -Next minor
13 11 - The "q" module now exports its "ref" function as a "Q"
14 12 constructor, with module systems that support exports
15 13 assignment including NodeJS, RequireJS, and when used as
2  package.json
... ... @@ -1,7 +1,7 @@
1 1 {
2 2 "name": "q",
3 3 "description": "A library for promises (CommonJS/Promises/A,B,D)",
4   - "version": "0.5.3",
  4 + "version": "0.6.0",
5 5 "homepage": "http://github.com/kriskowal/q/",
6 6 "author": "Kris Kowal <kris@cixar.com> (http://github.com/kriskowal/)",
7 7 "contributors": [
21 q.min.js
... ... @@ -1,10 +1,11 @@
1   -(function(m,c){typeof define==="function"?define(function(c,j){m(c,j)}):typeof exports==="object"?m(require,exports):m(c,Q={})})(function(m,c,e){function j(a){return a}function o(){var a=[],b,d=p(g.prototype);d.promiseSend=function(){var d=Array.prototype.slice.call(arguments);a?a.push(d):q.apply(e,[b].concat(d))};d.valueOf=function(){if(a)return d;return k(b)};var c=function(d){var c;if(a){b=l(d);d=0;for(c=a.length;d<c;++d)q.apply(e,[b].concat(a[d]));a=e;return b}};return{promise:s(d),resolve:c,
2   -reject:function(a){return c(f(a))}}}function g(a,b,d){b===e&&(b=function(a){return f("Promise does not support operation: "+a)});var c=p(g.prototype);c.promiseSend=function(d,c){var e=Array.prototype.slice.call(arguments,2),e=a[d]?a[d].apply(a,e):b.apply(a,[d].concat(e)),c=c||j;return c(e)};if(d)c.valueOf=d;return s(c)}function r(a){return a&&typeof a.promiseSend==="function"}function w(a){return!r(k(a))&&!t(a)}function t(a){a=k(a);if(a===e||a===null)return!1;return!!a.promiseRejected}function f(a){return g({when:function(b){return b?
3   -b(a):f(a)}},function(){return f(a)},function(){var b=p(f.prototype);b.promiseRejected=!0;b.reason=a;return b})}function l(a){if(r(a))return a;if(a&&typeof a.then==="function")return g({},function(b){return b!=="when"?h(a,function(a){return l(a).promiseSend.apply(null,arguments)}):(b=o(),a.then(b.resolve,b.reject),b.promise)});return g({when:function(){return a},get:function(b){if(a===e||a===null)return f("Cannot access property "+b+" of "+a);return a[b]},put:function(b,d){if(a===e||a===null)return f("Cannot set property "+
4   -b+" of "+a+" to "+d);return a[b]=d},del:function(b){if(a===e||a===null)return f("Cannot delete property "+b+" of "+a);return delete a[b]},post:function(b,d){if(a===e||a===null)return f(""+a+" has no methods");var c=a[b];if(!c)return f("No such method "+b+" on object "+a);if(!c.apply)return f("Property "+b+" on object "+a+" is not a method");return a[b].apply(a,d)},apply:function(b,d){if(!a||typeof a.apply!=="function")return f(""+a+" is not a function");return a.apply(b,d)},keys:function(){return y(a)}},
5   -e,function(){return a})}function h(a,b,d){function c(a){try{return b?b(a):a}catch(d){return f(d)}}function e(a){try{return d?d(a):f(a)}catch(b){return f(b)}}var g=o(),h=!1;q(l(a),"when",function(a){h||(h=!0,g.resolve(l(a).promiseSend("when",c,e)))},function(a){h||(h=!0,g.resolve(e(a)))});return g.promise}function i(a){return function(b){var d=Array.prototype.slice.call(arguments,1);return u.apply(e,[b,a].concat(d))}}function u(a,b){var d=o(),c=Array.prototype.slice.call(arguments,2);q.apply(e,[l(a),
6   -b,d.resolve].concat(c));return d.promise}function q(a){var b=Array.prototype.slice.call(arguments,1);n(function(){a.promiseSend.apply(a,b)})}var n;try{n=m("event-queue").enqueue}catch(B){n=function(a){setTimeout(a,0)}}var s=Object.freeze||j,p=Object.create||function(a){var b=function(){};b.prototype=a;return new b},y=Object.keys||function(a){var b=[],d;for(d in a)b.push(d);return b},v=Array.prototype.reduce||function(a,b){for(var d=0,c=this.length;d<c;d++)b=a(b,this[d],d);return b},x=typeof console===
7   -"undefined"?j:function(a){console.log(a)};c.enqueue=n;c.defer=o;c.makePromise=g;g.prototype.then=function(a,b){return h(this,a,b)};v.call(["get","put","del","post","invoke","keys","apply","call","wait","join","report","end"],function(a,b){g.prototype[b]=function(){return c[b].apply(c,[this].concat(Array.prototype.slice.call(arguments)))}},e);g.prototype.toSource=function(){return this.toString()};g.prototype.toString=function(){return"[object Promise]"};s(g.prototype);c.isPromise=r;c.isResolved=function(a){return!r(k(a.valueOf()))};
8   -c.isFulfilled=w;c.isRejected=t;c.reject=f;f.prototype=p(g.prototype,{constructor:{value:f}});c.ref=l;c.def=function(a){return g({isDef:function(){}},function(){var b=Array.prototype.slice.call(arguments);return u.apply(e,[a].concat(b))},function(){return a.valueOf()})};c.when=h;c.asap=function(a,b,d){b=b||j;if(w(a))return k(b(k(a)));else if(t(a))if(a=a.valueOf().reason,d)return d(a);else throw a;else return h(a,b,d)};var k=function(a){return a===e||a===null?a:a.valueOf()};c.Method=i;c.send=u;c.get=
9   -i("get");c.put=i("put");c.del=i("del");var z=c.post=i("post");c.invoke=function(a,b){var d=Array.prototype.slice.call(arguments,2);return z(a,b,d)};var A=c.apply=i("apply");c.call=function(a,b){var d=Array.prototype.slice.call(arguments,2);return A(a,b,d)};c.keys=i("keys");c.wait=function(a){var b=Array.prototype.slice.call(arguments,1);return v.call(b,function(a,b){return h(b,function(){return a})},a)};c.join=function(){var a=Array.prototype.slice.call(arguments),b=a.pop();return v.call(a,function(b,
10   -c,e){return h(c,function(c){return h(b,function(){a[e]=c})})},e).then(function(){return b.apply(e,a)})};c.report=function(a,b){b?b.message||(b=Error(b||"REPORT")):b=Error("REPORT");return h(a,e,function(a){x(b&&b.stack||b);x(a&&a.stack||a);return f(a)})};c.end=function(a){h(a,e,function(a){n(function(){throw a;})})}});
  1 +(function(n,c){typeof define==="function"?define(function(c,e,k){n(c,e,k)}):typeof exports==="object"?n(require,exports,module):Q=n(c,{},{})})(function(n,c,B,e){function k(a){return a}function o(){var a=[],b,d=p(g.prototype);d.promiseSend=function(){var d=Array.prototype.slice.call(arguments);a?a.push(d):q.apply(e,[b].concat(d))};d.valueOf=function(){if(a)return d;return l(b)};var c=function(d){var c;if(a){b=i(d);d=0;for(c=a.length;d<c;++d)q.apply(e,[b].concat(a[d]));a=e;return b}};return{promise:s(d),
  2 +resolve:c,reject:function(a){return c(f(a))}}}function g(a,b,d){b===e&&(b=function(a){return f("Promise does not support operation: "+a)});var c=p(g.prototype);c.promiseSend=function(d,c){var e=Array.prototype.slice.call(arguments,2),e=a[d]?a[d].apply(a,e):b.apply(a,[d].concat(e)),c=c||k;return c(e)};if(d)c.valueOf=d;return s(c)}function r(a){return a&&typeof a.promiseSend==="function"}function x(a){return!r(l(a))&&!t(a)}function t(a){a=l(a);if(a===e||a===null)return!1;return!!a.promiseRejected}function f(a){return g({when:function(b){return b?
  3 +b(a):f(a)}},function(){return f(a)},function(){var b=p(f.prototype);b.promiseRejected=!0;b.reason=a;return b})}function i(a){if(r(a))return a;if(a&&typeof a.then==="function")return g({},function(b){return b!=="when"?h(a,function(a){return i(a).promiseSend.apply(null,arguments)}):(b=o(),a.then(b.resolve,b.reject),b.promise)});return g({when:function(){return a},get:function(b){if(a===e||a===null)return f("Cannot access property "+b+" of "+a);return a[b]},put:function(b,d){if(a===e||a===null)return f("Cannot set property "+
  4 +b+" of "+a+" to "+d);return a[b]=d},del:function(b){if(a===e||a===null)return f("Cannot delete property "+b+" of "+a);return delete a[b]},post:function(b,d){if(a===e||a===null)return f(""+a+" has no methods");var c=a[b];if(!c)return f("No such method "+b+" on object "+a);if(!c.apply)return f("Property "+b+" on object "+a+" is not a method");return a[b].apply(a,d)},apply:function(b,d){if(!a||typeof a.apply!=="function")return f(""+a+" is not a function");return a.apply(b,d)},keys:function(){return C(a)}},
  5 +e,function(){return a})}function h(a,b,d){function c(a){try{return b?b(a):a}catch(d){return f(d)}}function e(a){try{return d?d(a):f(a)}catch(b){return f(b)}}var g=o(),h=!1;q(i(a),"when",function(a){h||(h=!0,g.resolve(i(a).promiseSend("when",c,e)))},function(a){h||(h=!0,g.resolve(e(a)))});return g.promise}function j(a){return function(b){var d=Array.prototype.slice.call(arguments,1);return u.apply(e,[b,a].concat(d))}}function u(a,b){var d=o(),c=Array.prototype.slice.call(arguments,2);q.apply(e,[i(a),
  6 +b,d.resolve].concat(c));return d.promise}function v(a){return h(a,function(a){var d=a.length,c=[];if(d===0)return i(c);var f=o();y.call(a,function(a,b,e){h(b,function(a){c[e]=a;--d===0&&f.resolve(c)},f.reject)},e);return f.promise})}function q(a){var b=Array.prototype.slice.call(arguments,1);m(function(){a.promiseSend.apply(a,b)})}var m;try{m=n("event-queue").enqueue}catch(F){if(typeof MessageChannel!=="undefined"){var z=new MessageChannel;m=function(a){z.port1.onmessage=a;z.port2.postMessage()}}else m=
  7 +function(a){setTimeout(a,0)}}var s=Object.freeze||k,p=Object.create||function(a){var b=function(){};b.prototype=a;return new b},C=Object.keys||function(a){var b=[],d;for(d in a)b.push(d);return b},y=Array.prototype.reduce||function(a,b){for(var d=0,c=this.length;d<c;d++)b=a(b,this[d],d);return b},w=typeof console==="undefined"?k:function(a){console.log(a)};c.enqueue=m;c.defer=o;c.makePromise=g;g.prototype.then=function(a,b){return h(this,a,b)};y.call(["when","get","put","del","post","invoke","keys",
  8 +"apply","call","all","wait","join","fail","fin","spy","report","end"],function(a,b){g.prototype[b]=function(){return c[b].apply(c,[this].concat(Array.prototype.slice.call(arguments)))}},e);g.prototype.toSource=function(){return this.toString()};g.prototype.toString=function(){return"[object Promise]"};s(g.prototype);c.isPromise=r;c.isResolved=function(a){return!r(l(a.valueOf()))};c.isFulfilled=x;c.isRejected=t;c.reject=f;f.prototype=p(g.prototype,{constructor:{value:f}});c.ref=i;c.master=c.def=function(a){return g({isDef:function(){}},
  9 +function(){var b=Array.prototype.slice.call(arguments);return u.apply(e,[a].concat(b))},function(){return a.valueOf()})};c.when=h;c.asap=function(a,b,d){b=b||k;if(x(a))return l(b(l(a)));else if(t(a))if(a=a.valueOf().reason,d)return d(a);else throw a;else return h(a,b,d)};var l=function(a){return a===e||a===null?a:a.valueOf()};c.async=function(a){return function(){var b=function(a,b){var g;try{g=d[a](b)}catch(i){return Object.prototype.toString.call(i)==="[object StopIteration]"?i.value:f(i)}return h(g,
  10 +c,e)},d=a.apply(this,arguments),c=b.bind(b,"send"),e=b.bind(b,"throw");return c()}};c.Method=j;c.send=u;c.get=j("get");c.put=j("put");c.del=j("del");var D=c.post=j("post");c.invoke=function(a,b){var c=Array.prototype.slice.call(arguments,2);return D(a,b,c)};var E=c.apply=j("apply");c.call=function(a,b){var c=Array.prototype.slice.call(arguments,2);return E(a,b,c)};c.keys=j("keys");c.all=v;c.wait=function(){return v(arguments).get(0)};c.join=function(){var a=Array.prototype.slice.call(arguments),b=
  11 +a.pop();return v(a).then(function(a){return b.apply(e,a)})};c.fail=function(a,b){return h(a,e,b)};c.spy=c.fin=function(a,b){return h(a,function(a){return h(b(e,a),function(){return a})},function(a){return h(b(a),function(){return f(a)})})};c.report=function(a,b){var c=Error(b||"REPORT");return spy(a,function(a,b){w(c&&c.stack||c);b?w(b&&b.stack||b):w(a)})};c.end=function(a){h(a,e,function(a){m(function(){throw a;})})};for(var A in c)i[A]=c[A];return B.exports=i});

0 comments on commit e642bca

Please sign in to comment.
Something went wrong with that request. Please try again.