Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

changing how the deliver method handles arguments

  • Loading branch information...
commit 8ef03b2e06e736bb3a8bbf9d8666b9f580076295 1 parent f3ac79e
@aaronpowell authored
Showing with 8 additions and 4 deletions.
  1. +4 −2 lib/postman.js
  2. +1 −1  lib/postman.min.js
  3. +3 −1 src/postman.coffee
View
6 lib/postman.js
@@ -63,11 +63,13 @@
};
};
cache = {};
- Postman.prototype.deliver = function(name, args) {
- var fn;
+ Postman.prototype.deliver = function() {
+ var args, fn, name;
+ name = arguments[0];
if (!cache[name]) {
createCache(name);
}
+ args = [].slice.call(arguments, 1);
if (!args) {
args = [];
}
View
2  lib/postman.min.js
@@ -1 +1 @@
-(function(){var a,b,c;a=function(){function a(){this.first=null,this.last=null,this.length=0}a.prototype.append=function(a){var b;if(!!a){b={data:a,next:null,prev:null},this.first?(this.last.next=b,b.prev=this.last,this.last=b):(this.first=b,this.last=b);return this.length++}},a.prototype.remove=function(a){if(!!a){a.prev?a.prev.next=a.next:(this.first=a.next,this.first&&(this.first.prev=null));return this.length--}};return a}(),c,b=function(){function j(){}var b,d,e,f,g,h,i;g=function(a){return a.constructor===Array},i=function(a){return a.constructor===Function},h=function(a){return a.constructor===Date},d=function(c){return b[c]={subs:new a,history:new a,constructor:function(){}}},b={},j.prototype.deliver=function(a,e){var f;b[a]||d(a),e||(e=[]),g(e)||(e=[e]),e={created:new Date,lastPublished:new Date,args:e},b[a].history.append(e),f=b[a].subs.first;while(f)f.data.apply(this,e.args),f=f.next;return c},j.prototype.deliverSync=function(a,e){var f;b[a]||d(a),e||(e=[]),g(e)||(e=[e]),e={created:new Date,lastPublished:new Date,args:e},b[a].history.append(e),f=b[a].subs.first;while(f)setTimeout(function(a){return function(){return a.data.apply(this,e.args)}}(f),0),f=f.next;return c},j.prototype.receive=function(a,e,f){var g;b[a]||d(a),b[a].subs.append(e);if(!f){g=b[a].history.first;while(g)e.apply(this,g.data.args),g.data.lastPublished=new Date,g=g.next;return c}},j.prototype.retract=function(e,f){var g,h;b[e]||d(e);if(!f)b[e].subs=new a;else{h=b[e].subs,g=h.first;while(g)g.data===f&&h.remove(g),g=g.next}return c},j.prototype.dropMessages=function(g,j){b[g]||d(g),j?(i(j)&&(b[g].history=f(j,b[g].history)),h(j)&&(b[g].history=e(j,b[g].history))):b[g].history=new a;return c.deliver("dropMessage."+g)},f=function(a,b){var c;c=b.first;while(c)a.apply(c.data)&&b.remove(c),c=c.next;return b},e=function(a,b){var c;c=b.first;while(c)c.data.created<a&&b.remove(c),c=c.next;return b};return j}(),c=new b,this.LinkedList=a,this.postman=c}).call(this)
+(function(){var a,b,c;a=function(){function a(){this.first=null,this.last=null,this.length=0}a.prototype.append=function(a){var b;if(!!a){b={data:a,next:null,prev:null},this.first?(this.last.next=b,b.prev=this.last,this.last=b):(this.first=b,this.last=b);return this.length++}},a.prototype.remove=function(a){if(!!a){a.prev?a.prev.next=a.next:(this.first=a.next,this.first&&(this.first.prev=null));return this.length--}};return a}(),c,b=function(){function j(){}var b,d,e,f,g,h,i;g=function(a){return a.constructor===Array},i=function(a){return a.constructor===Function},h=function(a){return a.constructor===Date},d=function(c){return b[c]={subs:new a,history:new a,constructor:function(){}}},b={},j.prototype.deliver=function(){var a,e,f;f=arguments[0],b[f]||d(f),a=[].slice.call(arguments,1),a||(a=[]),g(a)||(a=[a]),a={created:new Date,lastPublished:new Date,args:a},b[f].history.append(a),e=b[f].subs.first;while(e)e.data.apply(this,a.args),e=e.next;return c},j.prototype.deliverSync=function(a,e){var f;b[a]||d(a),e||(e=[]),g(e)||(e=[e]),e={created:new Date,lastPublished:new Date,args:e},b[a].history.append(e),f=b[a].subs.first;while(f)setTimeout(function(a){return function(){return a.data.apply(this,e.args)}}(f),0),f=f.next;return c},j.prototype.receive=function(a,e,f){var g;b[a]||d(a),b[a].subs.append(e);if(!f){g=b[a].history.first;while(g)e.apply(this,g.data.args),g.data.lastPublished=new Date,g=g.next;return c}},j.prototype.retract=function(e,f){var g,h;b[e]||d(e);if(!f)b[e].subs=new a;else{h=b[e].subs,g=h.first;while(g)g.data===f&&h.remove(g),g=g.next}return c},j.prototype.dropMessages=function(g,j){b[g]||d(g),j?(i(j)&&(b[g].history=f(j,b[g].history)),h(j)&&(b[g].history=e(j,b[g].history))):b[g].history=new a;return c.deliver("dropMessage."+g)},f=function(a,b){var c;c=b.first;while(c)a.apply(c.data)&&b.remove(c),c=c.next;return b},e=function(a,b){var c;c=b.first;while(c)c.data.created<a&&b.remove(c),c=c.next;return b};return j}(),c=new b,this.LinkedList=a,this.postman=c}).call(this)
View
4 src/postman.coffee
@@ -50,8 +50,10 @@ class Postman
constructor: () ->
cache = {}
- deliver: (name, args) ->
+ deliver: () ->
+ name = arguments[0]
createCache name if ! cache[name]
+ args = [].slice.call arguments, 1
args = [] if !args
args = [args] if !isArray args
args =
Please sign in to comment.
Something went wrong with that request. Please try again.