Comparing version 0.6.1 to 0.6.2
{ | ||
"name" : "postal", | ||
"description" : "Pub/Sub library providing wildcard subscriptions, complex message handling, etc. Works server and client-side.", | ||
"version" : "0.6.1", | ||
"version" : "0.6.2", | ||
"homepage" : "http://github.com/ifandelse/postal.js", | ||
@@ -6,0 +6,0 @@ "repository" : { |
@@ -5,3 +5,3 @@ /* | ||
License: Dual licensed MIT (http://www.opensource.org/licenses/mit-license) & GPL (http://www.opensource.org/licenses/gpl-license) | ||
Version 0.6.1 | ||
Version 0.6.2 | ||
*/ | ||
@@ -196,2 +196,3 @@ | ||
this.priority = priority; | ||
postal.configuration.bus.changePriority( this ); | ||
return this; | ||
@@ -254,2 +255,20 @@ }, | ||
changePriority: function ( subDef ) { | ||
var idx, found; | ||
if(this.subscriptions[subDef.channel] && this.subscriptions[subDef.channel][subDef.topic]) { | ||
this.subscriptions[subDef.channel][subDef.topic] = _.without(this.subscriptions[subDef.channel][subDef.topic], subDef); | ||
idx = this.subscriptions[subDef.channel][subDef.topic].length - 1; | ||
for ( ; idx >= 0; idx-- ) { | ||
if ( this.subscriptions[subDef.channel][subDef.topic][idx].priority <= subDef.priority ) { | ||
this.subscriptions[subDef.channel][subDef.topic].splice( idx + 1, 0, subDef ); | ||
found = true; | ||
break; | ||
} | ||
} | ||
if ( !found ) { | ||
this.subscriptions[subDef.channel][subDef.topic].unshift( subDef ); | ||
} | ||
} | ||
}, | ||
publish : function ( envelope ) { | ||
@@ -299,14 +318,3 @@ _.each( this.wireTaps, function ( tap ) { | ||
} | ||
idx = subs.length - 1; | ||
for ( ; idx >= 0; idx-- ) { | ||
if ( subs[idx].priority <= subDef.priority ) { | ||
subs.splice( idx + 1, 0, subDef ); | ||
found = true; | ||
break; | ||
} | ||
} | ||
if ( !found ) { | ||
subs.unshift( subDef ); | ||
} | ||
subs.push( subDef ); | ||
return subDef; | ||
@@ -313,0 +321,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18188
515