Changeset 3214 for lang/javascript/jsdeferred
- Timestamp:
- 12/17/07 19:19:56 (13 months ago)
- Location:
- lang/javascript/jsdeferred/trunk
- Files:
-
- 4 modified
-
jsdeferred.jquery.js (modified) (3 diffs)
-
jsdeferred.mini.js (modified) (3 diffs)
-
jsdeferred.nodoc.js (modified) (4 diffs)
-
jsdeferred.userscript.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/jsdeferred/trunk/jsdeferred.jquery.js
r3042 r3214 40 40 d.canceller=function(){try{clearTimeout(id)}catch(e){}};return d;};Deferred.next=function(fun){ 41 41 var d=new Deferred();var id=setTimeout(function(){clearTimeout(id);d.call()},0);if(fun)d.callback.ok=fun;d.canceller=function(){try{clearTimeout(id)}catch(e){}};return d;};Deferred.call=function(f,args){ 42 args=Array.prototype.slice.call(arguments);f=args.shift();return next(function(){42 args=Array.prototype.slice.call(arguments);f=args.shift();return Deferred.next(function(){ 43 43 return f.apply(this,args);});};Deferred.loop=function(n,fun){ 44 44 var o={ … … 48 48 last:false, 49 49 prev:null 50 };var ret,step=o.step;return next(function(){50 };var ret,step=o.step;return Deferred.next(function(){ 51 51 function _loop(i){ 52 52 if(i<=o.end){ … … 55 55 o.prev=ret;ret=fun.call(this,i,o);if(ret instanceof Deferred){ 56 56 return ret.next(function(r){ 57 ret=r;return call(_loop,i+step);});}else{58 return call(_loop,i+step);}57 ret=r;return Deferred.call(_loop,i+step);});}else{ 58 return Deferred.call(_loop,i+step);} 59 59 }else{ 60 60 return ret;} 61 61 } 62 return call(_loop,o.begin);});};Deferred.register=function(name,fun){62 return Deferred.call(_loop,o.begin);});};Deferred.register=function(name,fun){ 63 63 this.prototype[name]=function(){ 64 64 return this.next(Deferred.wrap(fun).apply(null,arguments));};};Deferred.wrap=function(dfun){ -
lang/javascript/jsdeferred/trunk/jsdeferred.mini.js
r3042 r3214 40 40 d.canceller=function(){try{clearTimeout(id)}catch(e){}};return d;};Deferred.next=function(fun){ 41 41 var d=new Deferred();var id=setTimeout(function(){clearTimeout(id);d.call()},0);if(fun)d.callback.ok=fun;d.canceller=function(){try{clearTimeout(id)}catch(e){}};return d;};Deferred.call=function(f,args){ 42 args=Array.prototype.slice.call(arguments);f=args.shift();return next(function(){42 args=Array.prototype.slice.call(arguments);f=args.shift();return Deferred.next(function(){ 43 43 return f.apply(this,args);});};Deferred.loop=function(n,fun){ 44 44 var o={ … … 48 48 last:false, 49 49 prev:null 50 };var ret,step=o.step;return next(function(){50 };var ret,step=o.step;return Deferred.next(function(){ 51 51 function _loop(i){ 52 52 if(i<=o.end){ … … 55 55 o.prev=ret;ret=fun.call(this,i,o);if(ret instanceof Deferred){ 56 56 return ret.next(function(r){ 57 ret=r;return call(_loop,i+step);});}else{58 return call(_loop,i+step);}57 ret=r;return Deferred.call(_loop,i+step);});}else{ 58 return Deferred.call(_loop,i+step);} 59 59 }else{ 60 60 return ret;} 61 61 } 62 return call(_loop,o.begin);});};Deferred.register=function(name,fun){62 return Deferred.call(_loop,o.begin);});};Deferred.register=function(name,fun){ 63 63 this.prototype[name]=function(){ 64 64 return this.next(Deferred.wrap(fun).apply(null,arguments));};};Deferred.wrap=function(dfun){ -
lang/javascript/jsdeferred/trunk/jsdeferred.nodoc.js
r3042 r3214 89 89 args = Array.prototype.slice.call(arguments); 90 90 f = args.shift(); 91 return next(function () {91 return Deferred.next(function () { 92 92 return f.apply(this, args); 93 93 }); … … 103 103 }; 104 104 var ret, step = o.step; 105 return next(function () {105 return Deferred.next(function () { 106 106 function _loop (i) { 107 107 if (i <= o.end) { … … 115 115 return ret.next(function (r) { 116 116 ret = r; 117 return call(_loop, i + step);117 return Deferred.call(_loop, i + step); 118 118 }); 119 119 } else { 120 return call(_loop, i + step);120 return Deferred.call(_loop, i + step); 121 121 } 122 122 } else { … … 124 124 } 125 125 } 126 return call(_loop, o.begin);126 return Deferred.call(_loop, o.begin); 127 127 }); 128 128 }; -
lang/javascript/jsdeferred/trunk/jsdeferred.userscript.js
r3042 r3214 93 93 args = Array.prototype.slice.call(arguments); 94 94 f = args.shift(); 95 return next(function () {95 return Deferred.next(function () { 96 96 return f.apply(this, args); 97 97 }); … … 107 107 }; 108 108 var ret, step = o.step; 109 return next(function () {109 return Deferred.next(function () { 110 110 function _loop (i) { 111 111 if (i <= o.end) { … … 119 119 return ret.next(function (r) { 120 120 ret = r; 121 return call(_loop, i + step);121 return Deferred.call(_loop, i + step); 122 122 }); 123 123 } else { 124 return call(_loop, i + step);124 return Deferred.call(_loop, i + step); 125 125 } 126 126 } else { … … 128 128 } 129 129 } 130 return call(_loop, o.begin);130 return Deferred.call(_loop, o.begin); 131 131 }); 132 132 }; … … 176 176 } 177 177 xhttp.get = function (url) { return xhttp({method:"get", url:url}) } 178 xhttp.post = function (url, data) { return xhttp({method:"post", url:url, data:data}) } 178 xhttp.post = function (url, data) { return xhttp({method:"post", url:url, data:data, headers:{"Content-Type":"application/x-www-form-urlencoded"}}) } 179 179 180 180 181 function http (opts) {
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)