From e59d3ab07a6b8d29a4ecc7400a77c5a501ae4607 Mon Sep 17 00:00:00 2001 From: Jim Cowart Date: Thu, 1 Mar 2012 03:40:47 -0500 Subject: [PATCH] initial pass for perf cleanup --- example/amd/js/libs/postal/postal.js | 10 +- example/standard/js/postal.js | 10 +- lib/browser/amd/postal.diagnostics.min.gz.js | Bin 243 -> 243 bytes lib/browser/amd/postal.js | 10 +- lib/browser/amd/postal.min.gz.js | Bin 1671 -> 1663 bytes lib/browser/amd/postal.min.js | 2 +- .../standard/postal.diagnostics.min.gz.js | Bin 220 -> 220 bytes lib/browser/standard/postal.js | 10 +- lib/browser/standard/postal.min.gz.js | Bin 1658 -> 1651 bytes lib/browser/standard/postal.min.js | 2 +- lib/node/postal.js | 10 +- spec/BindingsResolver.spec.js | 4 +- spec/Postal.spec.js | 122 ++++++++++-------- src/main/Api.js | 53 +++++--- src/main/BindingsResolver.js | 11 +- src/main/ChannelDefinition.js | 11 +- src/main/Constants.js | 34 +---- src/main/LocalBus.js | 25 ++-- src/main/SubscriptionDefinition.js | 24 ++-- 19 files changed, 171 insertions(+), 167 deletions(-) diff --git a/example/amd/js/libs/postal/postal.js b/example/amd/js/libs/postal/postal.js index 6f347ec..c2e46ad 100644 --- a/example/amd/js/libs/postal/postal.js +++ b/example/amd/js/libs/postal/postal.js @@ -315,15 +315,15 @@ var postal = { }, channel: function(exchange, topic) { - var exch = arguments.length === 2 ? exchange : DEFAULT_EXCHANGE, - tpc = arguments.length === 2 ? topic : exchange; + var exch = topic ? exchange : DEFAULT_EXCHANGE, + tpc = topic || exchange; return new ChannelDefinition(exch, tpc); }, subscribe: function(exchange, topic, callback) { - var exch = arguments.length === 3 ? exchange : DEFAULT_EXCHANGE, - tpc = arguments.length === 3 ? topic : exchange, - callbk = arguments.length === 3 ? callback : topic; + var callbk = callback || topic, + tpc = callback ? topic : exchange, + exch = callback ? exchange : DEFAULT_EXCHANGE; var channel = this.channel(exch, tpc); return channel.subscribe(callbk); }, diff --git a/example/standard/js/postal.js b/example/standard/js/postal.js index 28ec438..4fc5ba3 100644 --- a/example/standard/js/postal.js +++ b/example/standard/js/postal.js @@ -315,15 +315,15 @@ var postal = { }, channel: function(exchange, topic) { - var exch = arguments.length === 2 ? exchange : DEFAULT_EXCHANGE, - tpc = arguments.length === 2 ? topic : exchange; + var exch = topic ? exchange : DEFAULT_EXCHANGE, + tpc = topic || exchange; return new ChannelDefinition(exch, tpc); }, subscribe: function(exchange, topic, callback) { - var exch = arguments.length === 3 ? exchange : DEFAULT_EXCHANGE, - tpc = arguments.length === 3 ? topic : exchange, - callbk = arguments.length === 3 ? callback : topic; + var callbk = callback || topic, + tpc = callback ? topic : exchange, + exch = callback ? exchange : DEFAULT_EXCHANGE; var channel = this.channel(exch, tpc); return channel.subscribe(callbk); }, diff --git a/lib/browser/amd/postal.diagnostics.min.gz.js b/lib/browser/amd/postal.diagnostics.min.gz.js index e966d3c7bddd7f10496f9b4b12a078234ecdc7e4..a1b9e18b41b3f8e5caec41b2c8ba4d16c8a44f8a 100644 GIT binary patch delta 14 Vcmey&_?eMSzMF%Am1`o~TL2-X1T+8u delta 14 Vcmey&_?eMSzMF$VnsFlATL2;M1VI1* diff --git a/lib/browser/amd/postal.js b/lib/browser/amd/postal.js index 6f347ec..c2e46ad 100644 --- a/lib/browser/amd/postal.js +++ b/lib/browser/amd/postal.js @@ -315,15 +315,15 @@ var postal = { }, channel: function(exchange, topic) { - var exch = arguments.length === 2 ? exchange : DEFAULT_EXCHANGE, - tpc = arguments.length === 2 ? topic : exchange; + var exch = topic ? exchange : DEFAULT_EXCHANGE, + tpc = topic || exchange; return new ChannelDefinition(exch, tpc); }, subscribe: function(exchange, topic, callback) { - var exch = arguments.length === 3 ? exchange : DEFAULT_EXCHANGE, - tpc = arguments.length === 3 ? topic : exchange, - callbk = arguments.length === 3 ? callback : topic; + var callbk = callback || topic, + tpc = callback ? topic : exchange, + exch = callback ? exchange : DEFAULT_EXCHANGE; var channel = this.channel(exch, tpc); return channel.subscribe(callbk); }, diff --git a/lib/browser/amd/postal.min.gz.js b/lib/browser/amd/postal.min.gz.js index a30da790ddab8df269bff90d6940fa4477068daa..6d503d28a633eec99f122b5c3d4b3be5f0dc6572 100644 GIT binary patch literal 1663 zcmV-_27vh=iwFP(3QJD_1HD*VZ`(E${ws<$cw)n-&bmEJDi;)OhP|vU)?fqXdH_Wp z$x38NlPD*tt^dA5T`AkSU<3LTi);Yt>7hCuRL|1Ll#V>1=LtoSsn`} z7V{;p=KMa%xMW&5!XJ+rHyB4r3R39+)!GR0j%w*d9w<7WDnbE%PyoO2oA>?T{V!S1 z1N~~yDIw%lqP+i3Q(b_niqw)dU71F1{K4-w53PN2-tTcYEJFID z#4^2o`A@|YN6>)aGIvFip)U$T=!ryEiAS{@k8IT{F2`4J+I+Y8gW8YXyvS6h-Gyz- zDkwz}2jCsLatgQBwKEZBh@zbI4_Lb*OT##-3a%x%K~=hgU`J!FX%5 zaM*pwy8EUiHN~)m!rO}`&L*bl-EV52(ZR^J1a*b3lT`{0J;%_f8{ScTTw-E|H=#1M z;EgzRbiBRi@9}H53tqE1QL7@mwXarSZFo|Fg?w&e3DQ!TWeT#K-r&SqSEaH7u(*|0 z>j3wn#!3Z(<*D@rip;eeUleTW8dQe^*W%D)xf{e776uK?;RDmO&mv^Ph~aJHec|#v zPwpMl{U|S@YK?Y78%t;4D2`Gra__13BXuu84o4&LwR2wjm*#_bAv6v$tC zc?Y6Wu+R93ru>(2tz-O;1Gc|AF7G>o?q0P002e`zY=Zikh&~n|8#1gh+@I8KWCjc% zor%a%4CMsG=o@C4cvBSo9=B&R%$Z#1tY+qIv2P4cYC^@JNn3l8==X3o$%q^1-a(Mz zadNGGuw+{1Z=qJbJk+JC$v{;T0INiwnsV#2yt8?Zihb>K;4 z{lO!sOawz+F&*^^B`B4AO*5!YrD2A)c-}DVL&ZursZ?a^oEK*AKwDs)G(5Hlme`t_ zp9{VutPjc#jr1wZFA7H8J608dCV$9<-dzrmA+k z={MWfgzjr+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i&ARokAx)XVPL#rmW#o z9lNUCzicsR;j6uDy*cg&8B8h`BWsm5hgGgtIa%{fUpE+@{vX08ZHhk}%;%;%TP>P% zye9|7B3Cp{ztil(^aEHIi;stXK}H>RTW`>t_J`FK9*1{w+7)-0LVd{hs@l}W0So9) Ry8lO1=wEK#N_?*q000=CD3SmG diff --git a/lib/browser/amd/postal.min.js b/lib/browser/amd/postal.min.js index 326256a..0059a3e 100644 --- a/lib/browser/amd/postal.min.js +++ b/lib/browser/amd/postal.min.js @@ -1 +1 @@ -define(["underscore"],function(a){var b="/",c=50,d=0,e="postal",f=function(){},g=function(c){var d={envelope:{}},e;switch(c.length){case 3:typeof c[1]=="Object"&&typeof c[2]=="Object"?(d.envelope.exchange=b,d.envelope.topic=c[0],d.payload=c[1],e=d.envelope,d.envelope=a.extend(e,c[2])):(d.envelope.exchange=c[0],d.envelope.topic=c[1],d.payload=c[2]);break;case 4:d.envelope.exchange=c[0],d.envelope.topic=c[1],d.payload=c[2],e=d.envelope,d.envelope=a.extend(e,c[3]);break;default:d.envelope.exchange=b,d.envelope.topic=c[0],d.payload=c[1]}return d},h=function(){var b;return function(c){var d=!1;return a.isString(c)?(d=c===b,b=c):(d=a.isEqual(c,b),b=a.clone(c)),!d}},i=function(a,b){this.exchange=a,this.topic=b};i.prototype={subscribe:function(a){var b=new j(this.exchange,this.topic,a);return m.configuration.bus.subscribe(b),b},publish:function(b,c){var d=a.extend({exchange:this.exchange,timeStamp:new Date,topic:this.topic},c);m.configuration.bus.publish(b,d)}};var j=function(a,b,g){this.exchange=a,this.topic=b,this.callback=g,this.priority=c,this.constraints=[],this.maxCalls=d,this.onHandled=f,this.context=null,m.publish(e,"subscription.created",{event:"subscription.created",exchange:a,topic:b})};j.prototype={unsubscribe:function(){m.configuration.bus.unsubscribe(this),m.publish(e,"subscription.removed",{event:"subscription.removed",exchange:this.exchange,topic:this.topic})},defer:function(){var a=this.callback;return this.callback=function(b){setTimeout(a,0,b)},this},disposeAfter:function(b){if(a.isNaN(b)||b<=0)throw"The value provided to disposeAfter (maxCalls) must be a number greater than zero.";var c=this.onHandled,d=a.after(b,a.bind(function(){this.unsubscribe(this)},this));return this.onHandled=function(){c.apply(this.context,arguments),d()},this},ignoreDuplicates:function(){return this.withConstraint(new h),this},whenHandledThenExecute:function(b){if(!a.isFunction(b))throw"Value provided to 'whenHandledThenExecute' must be a function";return this.onHandled=b,this},withConstraint:function(b){if(!a.isFunction(b))throw"Predicate constraint must be a function";return this.constraints.push(b),this},withConstraints:function(b){var c=this;return a.isArray(b)&&a.each(b,function(a){c.withConstraint(a)}),c},withContext:function(a){return this.context=a,this},withDebounce:function(b){if(a.isNaN(b))throw"Milliseconds must be a number";var c=this.callback;return this.callback=a.debounce(c,b),this},withDelay:function(b){if(a.isNaN(b))throw"Milliseconds must be a number";var c=this.callback;return this.callback=function(a){setTimeout(c,b,a)},this},withPriority:function(b){if(a.isNaN(b))throw"Priority must be a number";return this.priority=b,this},withThrottle:function(b){if(a.isNaN(b))throw"Milliseconds must be a number";var c=this.callback;return this.callback=a.throttle(c,b),this}};var k={cache:{},compare:function(a,b){if(this.cache[b]&&this.cache[b][a])return!0;var c=new RegExp("^"+this.regexify(a)+"$"),d=c.test(b);return d&&(this.cache[b]||(this.cache[b]={}),this.cache[b][a]=!0),d},regexify:function(a){return a.replace(/\./g,"\\.").replace(/\*/g,".*").replace(/#/g,"[A-Z,a-z,0-9]*")}},l={subscriptions:{},wireTaps:[],publish:function(b,c){this.notifyTaps(b,c),a.each(this.subscriptions[c.exchange],function(d){a.each(d,function(d){m.configuration.resolver.compare(d.topic,c.topic)&&a.all(d.constraints,function(a){return a(b)})&&typeof d.callback=="function"&&(d.callback.apply(d.context,[b,c]),d.onHandled())})})},subscribe:function(a){var b,c,d,e,f;e=this.subscriptions[a.exchange]=this.subscriptions[a.exchange]||{},f=this.subscriptions[a.exchange][a.topic]=this.subscriptions[a.exchange][a.topic]||[],b=f.length-1;for(;b>=0;b--)if(f[b].priority<=a.priority){f.splice(b+1,0,a),c=!0;break}c||f.unshift(a)},notifyTaps:function(b,c){a.each(this.wireTaps,function(a){a(b,c)})},unsubscribe:function(a){if(this.subscriptions[a.exchange][a.topic]){var b=this.subscriptions[a.exchange][a.topic].length,c=0;for(;c=0;b--)if(f[b].priority<=a.priority){f.splice(b+1,0,a),c=!0;break}c||f.unshift(a)},notifyTaps:function(b,c){a.each(this.wireTaps,function(a){a(b,c)})},unsubscribe:function(a){if(this.subscriptions[a.exchange][a.topic]){var b=this.subscriptions[a.exchange][a.topic].length,c=0;for(;cl}=OgocLK31#U)wAz*!Ybu5&QgbBhW0yJSe)1|Z5)svmspS` z4vC#-rKE|CH)P;O`vynjC+)5>vKQ%2Bv~%JebeB;FK=SWBZs<)NH;P~l`ArhL>a}U0Ud6?JNsGVU%7da$xMX{*_Rb7c@Z<=-H*pq z+*sGnM3^B8Z0R46x;#t6cvBTrNpM+Jx`SXa69Y7P#ge#;yt$kiT(j@>cn4bJt@tGA zHuscG@2CWlvcVh8X+WGmXNXn|`Z#JDUunFa;05$Y5$irUO%g`=H3UWbofmOd#PW^= z`aDZZS$AG;lb5$h(KGL{R-i zC<^Z|o5;i!efUlNV`f?@2n358j_38kq8B0mltm2dCqd-$qr z`kE|}jEd~WzKDdiqe&$!z;hP|BCup;nSv~*cQ~@PRVghdENZ3ImciMk^-=-G($xAQ zip;hBF3qN)fmJ$CB@Rr!bXg2(VZhKb-*Zj(EQBVAjL~M?XD-e2Tig~upX(0}pIvA#<0o#hLVKg;AS9Fa!rAJG@8vs;AU&24Vx~Mm57`tL=y2w&V=U2p>a=*h6^)uZ;(~A@QLbt>C3==tN`D zb`Z!^Q^6zCD&{!A0*AgJGw9F}ohOd#8oU!e!34isT-ML!t84HxBcWd9PEP$WD;%Hw zOqM=7IYE#zAq3};{jUifexrTpmZ}LuE*_u47z6nT>%+2JU>aW6p_&MyIBe@Z9%JSp zqRimw<8Klcyya6s&(4W-Ozo#%Y<93`uxnu8VapC0{+jvx_!vE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@su?z0Z8rorC8u9T_z+UW?#m;1Z8*>kiTB-T1utDgCmM>j zgFvR53LcqOF~GID E07(icbN~PV diff --git a/lib/browser/standard/postal.min.js b/lib/browser/standard/postal.min.js index b068918..de9c0f8 100644 --- a/lib/browser/standard/postal.min.js +++ b/lib/browser/standard/postal.min.js @@ -1 +1 @@ -(function(a,b){var c="/",d=50,e=0,f="postal",g=function(){},h=function(a){var b={envelope:{}},d;switch(a.length){case 3:typeof a[1]=="Object"&&typeof a[2]=="Object"?(b.envelope.exchange=c,b.envelope.topic=a[0],b.payload=a[1],d=b.envelope,b.envelope=_.extend(d,a[2])):(b.envelope.exchange=a[0],b.envelope.topic=a[1],b.payload=a[2]);break;case 4:b.envelope.exchange=a[0],b.envelope.topic=a[1],b.payload=a[2],d=b.envelope,b.envelope=_.extend(d,a[3]);break;default:b.envelope.exchange=c,b.envelope.topic=a[0],b.payload=a[1]}return b},i=function(){var a;return function(b){var c=!1;return _.isString(b)?(c=b===a,a=b):(c=_.isEqual(b,a),a=_.clone(b)),!c}},j=function(a,b){this.exchange=a,this.topic=b};j.prototype={subscribe:function(a){var b=new k(this.exchange,this.topic,a);return n.configuration.bus.subscribe(b),b},publish:function(a,b){var c=_.extend({exchange:this.exchange,timeStamp:new Date,topic:this.topic},b);n.configuration.bus.publish(a,c)}};var k=function(a,b,c){this.exchange=a,this.topic=b,this.callback=c,this.priority=d,this.constraints=[],this.maxCalls=e,this.onHandled=g,this.context=null,n.publish(f,"subscription.created",{event:"subscription.created",exchange:a,topic:b})};k.prototype={unsubscribe:function(){n.configuration.bus.unsubscribe(this),n.publish(f,"subscription.removed",{event:"subscription.removed",exchange:this.exchange,topic:this.topic})},defer:function(){var a=this.callback;return this.callback=function(b){setTimeout(a,0,b)},this},disposeAfter:function(a){if(_.isNaN(a)||a<=0)throw"The value provided to disposeAfter (maxCalls) must be a number greater than zero.";var b=this.onHandled,c=_.after(a,_.bind(function(){this.unsubscribe(this)},this));return this.onHandled=function(){b.apply(this.context,arguments),c()},this},ignoreDuplicates:function(){return this.withConstraint(new i),this},whenHandledThenExecute:function(a){if(!_.isFunction(a))throw"Value provided to 'whenHandledThenExecute' must be a function";return this.onHandled=a,this},withConstraint:function(a){if(!_.isFunction(a))throw"Predicate constraint must be a function";return this.constraints.push(a),this},withConstraints:function(a){var b=this;return _.isArray(a)&&_.each(a,function(a){b.withConstraint(a)}),b},withContext:function(a){return this.context=a,this},withDebounce:function(a){if(_.isNaN(a))throw"Milliseconds must be a number";var b=this.callback;return this.callback=_.debounce(b,a),this},withDelay:function(a){if(_.isNaN(a))throw"Milliseconds must be a number";var b=this.callback;return this.callback=function(c){setTimeout(b,a,c)},this},withPriority:function(a){if(_.isNaN(a))throw"Priority must be a number";return this.priority=a,this},withThrottle:function(a){if(_.isNaN(a))throw"Milliseconds must be a number";var b=this.callback;return this.callback=_.throttle(b,a),this}};var l={cache:{},compare:function(a,b){if(this.cache[b]&&this.cache[b][a])return!0;var c=new RegExp("^"+this.regexify(a)+"$"),d=c.test(b);return d&&(this.cache[b]||(this.cache[b]={}),this.cache[b][a]=!0),d},regexify:function(a){return a.replace(/\./g,"\\.").replace(/\*/g,".*").replace(/#/g,"[A-Z,a-z,0-9]*")}},m={subscriptions:{},wireTaps:[],publish:function(a,b){this.notifyTaps(a,b),_.each(this.subscriptions[b.exchange],function(c){_.each(c,function(c){n.configuration.resolver.compare(c.topic,b.topic)&&_.all(c.constraints,function(b){return b(a)})&&typeof c.callback=="function"&&(c.callback.apply(c.context,[a,b]),c.onHandled())})})},subscribe:function(a){var b,c,d,e,f;e=this.subscriptions[a.exchange]=this.subscriptions[a.exchange]||{},f=this.subscriptions[a.exchange][a.topic]=this.subscriptions[a.exchange][a.topic]||[],b=f.length-1;for(;b>=0;b--)if(f[b].priority<=a.priority){f.splice(b+1,0,a),c=!0;break}c||f.unshift(a)},notifyTaps:function(a,b){_.each(this.wireTaps,function(c){c(a,b)})},unsubscribe:function(a){if(this.subscriptions[a.exchange][a.topic]){var b=this.subscriptions[a.exchange][a.topic].length,c=0;for(;c=0;b--)if(f[b].priority<=a.priority){f.splice(b+1,0,a),c=!0;break}c||f.unshift(a)},notifyTaps:function(a,b){_.each(this.wireTaps,function(c){c(a,b)})},unsubscribe:function(a){if(this.subscriptions[a.exchange][a.topic]){var b=this.subscriptions[a.exchange][a.topic].length,c=0;for(;c