From be9ca57c463bbc317e046261f328a7b27de951d0 Mon Sep 17 00:00:00 2001 From: Jim Cowart Date: Thu, 1 Mar 2012 03:42:33 -0500 Subject: [PATCH] Updated build artifacts --- example/amd/js/libs/postal/postal.js | 146 ++++++++---------- example/standard/js/postal.js | 146 ++++++++---------- lib/browser/amd/postal.diagnostics.min.gz.js | Bin 243 -> 243 bytes lib/browser/amd/postal.js | 146 ++++++++---------- lib/browser/amd/postal.min.gz.js | Bin 1663 -> 1543 bytes lib/browser/amd/postal.min.js | 2 +- .../standard/postal.diagnostics.min.gz.js | Bin 220 -> 220 bytes lib/browser/standard/postal.js | 146 ++++++++---------- lib/browser/standard/postal.min.gz.js | Bin 1651 -> 1516 bytes lib/browser/standard/postal.min.js | 2 +- lib/node/postal.js | 146 ++++++++---------- 11 files changed, 342 insertions(+), 392 deletions(-) diff --git a/example/amd/js/libs/postal/postal.js b/example/amd/js/libs/postal/postal.js index c2e46ad..5d49000 100644 --- a/example/amd/js/libs/postal/postal.js +++ b/example/amd/js/libs/postal/postal.js @@ -10,39 +10,7 @@ var DEFAULT_EXCHANGE = "/", DEFAULT_PRIORITY = 50, DEFAULT_DISPOSEAFTER = 0, SYSTEM_EXCHANGE = "postal", - NO_OP = function() { }, - parsePublishArgs = function(args) { - var parsed = { envelope: { } }, env; - switch(args.length) { - case 3: - if(typeof args[1] === "Object" && typeof args[2] === "Object") { - parsed.envelope.exchange = DEFAULT_EXCHANGE; - parsed.envelope.topic = args[0]; - parsed.payload = args[1]; - env = parsed.envelope; - parsed.envelope = _.extend(env, args[2]); - } - else { - parsed.envelope.exchange = args[0]; - parsed.envelope.topic = args[1]; - parsed.payload = args[2]; - } - break; - case 4: - parsed.envelope.exchange = args[0]; - parsed.envelope.topic = args[1]; - parsed.payload = args[2]; - env = parsed.envelope; - parsed.envelope = _.extend(env, args[3]); - break; - default: - parsed.envelope.exchange = DEFAULT_EXCHANGE; - parsed.envelope.topic = args[0]; - parsed.payload = args[1]; - break; - } - return parsed; - }; + NO_OP = function() { }; var DistinctPredicate = function() { var previous; @@ -73,12 +41,11 @@ ChannelDefinition.prototype = { }, publish: function(data, envelope) { - var env = _.extend({ - exchange: this.exchange, - timeStamp: new Date(), - topic: this.topic - }, envelope); - postal.configuration.bus.publish(data, env); + var env = envelope || {}; + env.exchange = this.exchange; + env.timeStamp = new Date(); + env.topic = this.topic; + postal.configuration.bus.publish(env, data); } }; @@ -87,12 +54,15 @@ var SubscriptionDefinition = function(exchange, topic, callback) { this.topic = topic; this.callback = callback; this.priority = DEFAULT_PRIORITY; - this.constraints = []; + this.constraints = new Array(0); this.maxCalls = DEFAULT_DISPOSEAFTER; this.onHandled = NO_OP; this.context = null; - postal.publish(SYSTEM_EXCHANGE, "subscription.created", + postal.publish({ + exchange: SYSTEM_EXCHANGE, + topic: "subscription.created" + }, { event: "subscription.created", exchange: exchange, @@ -103,7 +73,10 @@ var SubscriptionDefinition = function(exchange, topic, callback) { SubscriptionDefinition.prototype = { unsubscribe: function() { postal.configuration.bus.unsubscribe(this); - postal.publish(SYSTEM_EXCHANGE, "subscription.removed", + postal.publish({ + exchange: SYSTEM_EXCHANGE, + topic: "subscription.removed" + }, { event: "subscription.removed", exchange: this.exchange, @@ -215,7 +188,10 @@ var bindingsResolver = { if(this.cache[topic] && this.cache[topic][binding]) { return true; } - var rgx = new RegExp("^" + this.regexify(binding) + "$"), // match from start to end of string + // binding.replace(/\./g,"\\.") // escape actual periods + // .replace(/\*/g, ".*") // asterisks match any value + // .replace(/#/g, "[A-Z,a-z,0-9]*"); // hash matches any alpha-numeric 'word' + var rgx = new RegExp("^" + binding.replace(/\./g,"\\.").replace(/\*/g, ".*").replace(/#/g, "[A-Z,a-z,0-9]*") + "$"), result = rgx.test(topic); if(result) { if(!this.cache[topic]) { @@ -224,12 +200,6 @@ var bindingsResolver = { this.cache[topic][binding] = true; } return result; - }, - - regexify: function(binding) { - return binding.replace(/\./g,"\\.") // escape actual periods - .replace(/\*/g, ".*") // asterisks match any value - .replace(/#/g, "[A-Z,a-z,0-9]*"); // hash matches any alpha-numeric 'word' } }; @@ -237,10 +207,12 @@ var localBus = { subscriptions: {}, - wireTaps: [], + wireTaps: new Array(0), - publish: function(data, envelope) { - this.notifyTaps(data, envelope); + publish: function(envelope, data) { + _.each(this.wireTaps,function(tap) { + tap(envelope, data); + }); _.each(this.subscriptions[envelope.exchange], function(topic) { _.each(topic, function(binding){ @@ -257,10 +229,15 @@ var localBus = { }, subscribe: function(subDef) { - var idx, found, fn, exch, subs; + var idx, found, fn, exch = this.subscriptions[subDef.exchange], subs; - exch = this.subscriptions[subDef.exchange] = this.subscriptions[subDef.exchange] || {}; - subs = this.subscriptions[subDef.exchange][subDef.topic] = this.subscriptions[subDef.exchange][subDef.topic] || []; + if(!exch) { + exch = this.subscriptions[subDef.exchange] = {}; + } + subs = this.subscriptions[subDef.exchange][subDef.topic] + if(!subs) { + subs = this.subscriptions[subDef.exchange][subDef.topic] = new Array(0); + } idx = subs.length - 1; //if(!_.any(subs, function(cfg) { return cfg === subDef; })) { @@ -277,12 +254,6 @@ var localBus = { //} }, - notifyTaps: function(data, envelope) { - _.each(this.wireTaps,function(tap) { - tap(data, envelope); - }); - }, - unsubscribe: function(config) { if(this.subscriptions[config.exchange][config.topic]) { var len = this.subscriptions[config.exchange][config.topic].length, @@ -308,30 +279,42 @@ var localBus = { } }; +var publishPicker = { + "2" : function(envelope, payload) { + if(!envelope.exchange) { + envelope.exchange = DEFAULT_EXCHANGE; + } + postal.configuration.bus.publish(envelope, payload); + }, + "3" : function(exchange, topic, payload) { + postal.configuration.bus.publish({ exchange: exchange, topic: topic }, payload); + } +}; + var postal = { configuration: { bus: localBus, resolver: bindingsResolver }, - channel: function(exchange, topic) { - var exch = topic ? exchange : DEFAULT_EXCHANGE, - tpc = topic || exchange; + channel: function(options) { + var exch = options.exchange || DEFAULT_EXCHANGE, + tpc = options.topic; return new ChannelDefinition(exch, tpc); }, - subscribe: function(exchange, topic, callback) { - var callbk = callback || topic, - tpc = callback ? topic : exchange, - exch = callback ? exchange : DEFAULT_EXCHANGE; - var channel = this.channel(exch, tpc); - return channel.subscribe(callbk); + subscribe: function(options) { + var callback = options.callback, + topic = options.topic, + exchange = options.exchange || DEFAULT_EXCHANGE; + return new ChannelDefinition(exchange, topic).subscribe(callback); }, - publish: function(exchange, topic, payload, envelopeOptions) { - var parsedArgs = parsePublishArgs([].slice.call(arguments,0)); - var channel = this.channel(parsedArgs.envelope.exchange, parsedArgs.envelope.topic); - channel.publish(parsedArgs.payload, parsedArgs.envelope); + publish: function() { + var len = arguments.length; + if(publishPicker[len]) { + publishPicker[len].apply(this, arguments); + } }, addWireTap: function(callback) { @@ -339,21 +322,28 @@ var postal = { }, bindExchanges: function(sources, destinations) { - var subscriptions = []; + var subscriptions; if(!_.isArray(sources)) { sources = [sources]; } if(!_.isArray(destinations)) { destinations = [destinations]; } + subscriptions = new Array(sources.length * destinations.length); _.each(sources, function(source){ var sourceTopic = source.topic || "*"; _.each(destinations, function(destination) { var destExchange = destination.exchange || DEFAULT_EXCHANGE; subscriptions.push( - postal.subscribe(source.exchange || DEFAULT_EXCHANGE, source.topic || "*", function(msg, env) { - var destTopic = _.isFunction(destination.topic) ? destination.topic(env.topic) : destination.topic || env.topic; - postal.publish(destExchange, destTopic, msg); + postal.subscribe({ + exchange: source.exchange || DEFAULT_EXCHANGE, + topic: source.topic || "*", + callback : function(msg, env) { + var newEnv = env; + newEnv.topic = _.isFunction(destination.topic) ? destination.topic(env.topic) : destination.topic || env.topic; + newEnv.exchange = destExchange; + postal.publish(newEnv, msg); + } }) ); }); diff --git a/example/standard/js/postal.js b/example/standard/js/postal.js index 4fc5ba3..be4fc1c 100644 --- a/example/standard/js/postal.js +++ b/example/standard/js/postal.js @@ -10,39 +10,7 @@ var DEFAULT_EXCHANGE = "/", DEFAULT_PRIORITY = 50, DEFAULT_DISPOSEAFTER = 0, SYSTEM_EXCHANGE = "postal", - NO_OP = function() { }, - parsePublishArgs = function(args) { - var parsed = { envelope: { } }, env; - switch(args.length) { - case 3: - if(typeof args[1] === "Object" && typeof args[2] === "Object") { - parsed.envelope.exchange = DEFAULT_EXCHANGE; - parsed.envelope.topic = args[0]; - parsed.payload = args[1]; - env = parsed.envelope; - parsed.envelope = _.extend(env, args[2]); - } - else { - parsed.envelope.exchange = args[0]; - parsed.envelope.topic = args[1]; - parsed.payload = args[2]; - } - break; - case 4: - parsed.envelope.exchange = args[0]; - parsed.envelope.topic = args[1]; - parsed.payload = args[2]; - env = parsed.envelope; - parsed.envelope = _.extend(env, args[3]); - break; - default: - parsed.envelope.exchange = DEFAULT_EXCHANGE; - parsed.envelope.topic = args[0]; - parsed.payload = args[1]; - break; - } - return parsed; - }; + NO_OP = function() { }; var DistinctPredicate = function() { var previous; @@ -73,12 +41,11 @@ ChannelDefinition.prototype = { }, publish: function(data, envelope) { - var env = _.extend({ - exchange: this.exchange, - timeStamp: new Date(), - topic: this.topic - }, envelope); - postal.configuration.bus.publish(data, env); + var env = envelope || {}; + env.exchange = this.exchange; + env.timeStamp = new Date(); + env.topic = this.topic; + postal.configuration.bus.publish(env, data); } }; @@ -87,12 +54,15 @@ var SubscriptionDefinition = function(exchange, topic, callback) { this.topic = topic; this.callback = callback; this.priority = DEFAULT_PRIORITY; - this.constraints = []; + this.constraints = new Array(0); this.maxCalls = DEFAULT_DISPOSEAFTER; this.onHandled = NO_OP; this.context = null; - postal.publish(SYSTEM_EXCHANGE, "subscription.created", + postal.publish({ + exchange: SYSTEM_EXCHANGE, + topic: "subscription.created" + }, { event: "subscription.created", exchange: exchange, @@ -103,7 +73,10 @@ var SubscriptionDefinition = function(exchange, topic, callback) { SubscriptionDefinition.prototype = { unsubscribe: function() { postal.configuration.bus.unsubscribe(this); - postal.publish(SYSTEM_EXCHANGE, "subscription.removed", + postal.publish({ + exchange: SYSTEM_EXCHANGE, + topic: "subscription.removed" + }, { event: "subscription.removed", exchange: this.exchange, @@ -215,7 +188,10 @@ var bindingsResolver = { if(this.cache[topic] && this.cache[topic][binding]) { return true; } - var rgx = new RegExp("^" + this.regexify(binding) + "$"), // match from start to end of string + // binding.replace(/\./g,"\\.") // escape actual periods + // .replace(/\*/g, ".*") // asterisks match any value + // .replace(/#/g, "[A-Z,a-z,0-9]*"); // hash matches any alpha-numeric 'word' + var rgx = new RegExp("^" + binding.replace(/\./g,"\\.").replace(/\*/g, ".*").replace(/#/g, "[A-Z,a-z,0-9]*") + "$"), result = rgx.test(topic); if(result) { if(!this.cache[topic]) { @@ -224,12 +200,6 @@ var bindingsResolver = { this.cache[topic][binding] = true; } return result; - }, - - regexify: function(binding) { - return binding.replace(/\./g,"\\.") // escape actual periods - .replace(/\*/g, ".*") // asterisks match any value - .replace(/#/g, "[A-Z,a-z,0-9]*"); // hash matches any alpha-numeric 'word' } }; @@ -237,10 +207,12 @@ var localBus = { subscriptions: {}, - wireTaps: [], + wireTaps: new Array(0), - publish: function(data, envelope) { - this.notifyTaps(data, envelope); + publish: function(envelope, data) { + _.each(this.wireTaps,function(tap) { + tap(envelope, data); + }); _.each(this.subscriptions[envelope.exchange], function(topic) { _.each(topic, function(binding){ @@ -257,10 +229,15 @@ var localBus = { }, subscribe: function(subDef) { - var idx, found, fn, exch, subs; + var idx, found, fn, exch = this.subscriptions[subDef.exchange], subs; - exch = this.subscriptions[subDef.exchange] = this.subscriptions[subDef.exchange] || {}; - subs = this.subscriptions[subDef.exchange][subDef.topic] = this.subscriptions[subDef.exchange][subDef.topic] || []; + if(!exch) { + exch = this.subscriptions[subDef.exchange] = {}; + } + subs = this.subscriptions[subDef.exchange][subDef.topic] + if(!subs) { + subs = this.subscriptions[subDef.exchange][subDef.topic] = new Array(0); + } idx = subs.length - 1; //if(!_.any(subs, function(cfg) { return cfg === subDef; })) { @@ -277,12 +254,6 @@ var localBus = { //} }, - notifyTaps: function(data, envelope) { - _.each(this.wireTaps,function(tap) { - tap(data, envelope); - }); - }, - unsubscribe: function(config) { if(this.subscriptions[config.exchange][config.topic]) { var len = this.subscriptions[config.exchange][config.topic].length, @@ -308,30 +279,42 @@ var localBus = { } }; +var publishPicker = { + "2" : function(envelope, payload) { + if(!envelope.exchange) { + envelope.exchange = DEFAULT_EXCHANGE; + } + postal.configuration.bus.publish(envelope, payload); + }, + "3" : function(exchange, topic, payload) { + postal.configuration.bus.publish({ exchange: exchange, topic: topic }, payload); + } +}; + var postal = { configuration: { bus: localBus, resolver: bindingsResolver }, - channel: function(exchange, topic) { - var exch = topic ? exchange : DEFAULT_EXCHANGE, - tpc = topic || exchange; + channel: function(options) { + var exch = options.exchange || DEFAULT_EXCHANGE, + tpc = options.topic; return new ChannelDefinition(exch, tpc); }, - subscribe: function(exchange, topic, callback) { - var callbk = callback || topic, - tpc = callback ? topic : exchange, - exch = callback ? exchange : DEFAULT_EXCHANGE; - var channel = this.channel(exch, tpc); - return channel.subscribe(callbk); + subscribe: function(options) { + var callback = options.callback, + topic = options.topic, + exchange = options.exchange || DEFAULT_EXCHANGE; + return new ChannelDefinition(exchange, topic).subscribe(callback); }, - publish: function(exchange, topic, payload, envelopeOptions) { - var parsedArgs = parsePublishArgs([].slice.call(arguments,0)); - var channel = this.channel(parsedArgs.envelope.exchange, parsedArgs.envelope.topic); - channel.publish(parsedArgs.payload, parsedArgs.envelope); + publish: function() { + var len = arguments.length; + if(publishPicker[len]) { + publishPicker[len].apply(this, arguments); + } }, addWireTap: function(callback) { @@ -339,21 +322,28 @@ var postal = { }, bindExchanges: function(sources, destinations) { - var subscriptions = []; + var subscriptions; if(!_.isArray(sources)) { sources = [sources]; } if(!_.isArray(destinations)) { destinations = [destinations]; } + subscriptions = new Array(sources.length * destinations.length); _.each(sources, function(source){ var sourceTopic = source.topic || "*"; _.each(destinations, function(destination) { var destExchange = destination.exchange || DEFAULT_EXCHANGE; subscriptions.push( - postal.subscribe(source.exchange || DEFAULT_EXCHANGE, source.topic || "*", function(msg, env) { - var destTopic = _.isFunction(destination.topic) ? destination.topic(env.topic) : destination.topic || env.topic; - postal.publish(destExchange, destTopic, msg); + postal.subscribe({ + exchange: source.exchange || DEFAULT_EXCHANGE, + topic: source.topic || "*", + callback : function(msg, env) { + var newEnv = env; + newEnv.topic = _.isFunction(destination.topic) ? destination.topic(env.topic) : destination.topic || env.topic; + newEnv.exchange = destExchange; + postal.publish(newEnv, msg); + } }) ); }); diff --git a/lib/browser/amd/postal.diagnostics.min.gz.js b/lib/browser/amd/postal.diagnostics.min.gz.js index a1b9e18b41b3f8e5caec41b2c8ba4d16c8a44f8a..f79dcd20efdac79eead92ebe5c8dfa40fbc28564 100644 GIT binary patch delta 15 Wcmey&_?eMizMF#~-^_m^`x^i#^aUCK delta 15 Wcmey&_?eMizMF%AmCJh~`x^iyj0AuH diff --git a/lib/browser/amd/postal.js b/lib/browser/amd/postal.js index c2e46ad..5d49000 100644 --- a/lib/browser/amd/postal.js +++ b/lib/browser/amd/postal.js @@ -10,39 +10,7 @@ var DEFAULT_EXCHANGE = "/", DEFAULT_PRIORITY = 50, DEFAULT_DISPOSEAFTER = 0, SYSTEM_EXCHANGE = "postal", - NO_OP = function() { }, - parsePublishArgs = function(args) { - var parsed = { envelope: { } }, env; - switch(args.length) { - case 3: - if(typeof args[1] === "Object" && typeof args[2] === "Object") { - parsed.envelope.exchange = DEFAULT_EXCHANGE; - parsed.envelope.topic = args[0]; - parsed.payload = args[1]; - env = parsed.envelope; - parsed.envelope = _.extend(env, args[2]); - } - else { - parsed.envelope.exchange = args[0]; - parsed.envelope.topic = args[1]; - parsed.payload = args[2]; - } - break; - case 4: - parsed.envelope.exchange = args[0]; - parsed.envelope.topic = args[1]; - parsed.payload = args[2]; - env = parsed.envelope; - parsed.envelope = _.extend(env, args[3]); - break; - default: - parsed.envelope.exchange = DEFAULT_EXCHANGE; - parsed.envelope.topic = args[0]; - parsed.payload = args[1]; - break; - } - return parsed; - }; + NO_OP = function() { }; var DistinctPredicate = function() { var previous; @@ -73,12 +41,11 @@ ChannelDefinition.prototype = { }, publish: function(data, envelope) { - var env = _.extend({ - exchange: this.exchange, - timeStamp: new Date(), - topic: this.topic - }, envelope); - postal.configuration.bus.publish(data, env); + var env = envelope || {}; + env.exchange = this.exchange; + env.timeStamp = new Date(); + env.topic = this.topic; + postal.configuration.bus.publish(env, data); } }; @@ -87,12 +54,15 @@ var SubscriptionDefinition = function(exchange, topic, callback) { this.topic = topic; this.callback = callback; this.priority = DEFAULT_PRIORITY; - this.constraints = []; + this.constraints = new Array(0); this.maxCalls = DEFAULT_DISPOSEAFTER; this.onHandled = NO_OP; this.context = null; - postal.publish(SYSTEM_EXCHANGE, "subscription.created", + postal.publish({ + exchange: SYSTEM_EXCHANGE, + topic: "subscription.created" + }, { event: "subscription.created", exchange: exchange, @@ -103,7 +73,10 @@ var SubscriptionDefinition = function(exchange, topic, callback) { SubscriptionDefinition.prototype = { unsubscribe: function() { postal.configuration.bus.unsubscribe(this); - postal.publish(SYSTEM_EXCHANGE, "subscription.removed", + postal.publish({ + exchange: SYSTEM_EXCHANGE, + topic: "subscription.removed" + }, { event: "subscription.removed", exchange: this.exchange, @@ -215,7 +188,10 @@ var bindingsResolver = { if(this.cache[topic] && this.cache[topic][binding]) { return true; } - var rgx = new RegExp("^" + this.regexify(binding) + "$"), // match from start to end of string + // binding.replace(/\./g,"\\.") // escape actual periods + // .replace(/\*/g, ".*") // asterisks match any value + // .replace(/#/g, "[A-Z,a-z,0-9]*"); // hash matches any alpha-numeric 'word' + var rgx = new RegExp("^" + binding.replace(/\./g,"\\.").replace(/\*/g, ".*").replace(/#/g, "[A-Z,a-z,0-9]*") + "$"), result = rgx.test(topic); if(result) { if(!this.cache[topic]) { @@ -224,12 +200,6 @@ var bindingsResolver = { this.cache[topic][binding] = true; } return result; - }, - - regexify: function(binding) { - return binding.replace(/\./g,"\\.") // escape actual periods - .replace(/\*/g, ".*") // asterisks match any value - .replace(/#/g, "[A-Z,a-z,0-9]*"); // hash matches any alpha-numeric 'word' } }; @@ -237,10 +207,12 @@ var localBus = { subscriptions: {}, - wireTaps: [], + wireTaps: new Array(0), - publish: function(data, envelope) { - this.notifyTaps(data, envelope); + publish: function(envelope, data) { + _.each(this.wireTaps,function(tap) { + tap(envelope, data); + }); _.each(this.subscriptions[envelope.exchange], function(topic) { _.each(topic, function(binding){ @@ -257,10 +229,15 @@ var localBus = { }, subscribe: function(subDef) { - var idx, found, fn, exch, subs; + var idx, found, fn, exch = this.subscriptions[subDef.exchange], subs; - exch = this.subscriptions[subDef.exchange] = this.subscriptions[subDef.exchange] || {}; - subs = this.subscriptions[subDef.exchange][subDef.topic] = this.subscriptions[subDef.exchange][subDef.topic] || []; + if(!exch) { + exch = this.subscriptions[subDef.exchange] = {}; + } + subs = this.subscriptions[subDef.exchange][subDef.topic] + if(!subs) { + subs = this.subscriptions[subDef.exchange][subDef.topic] = new Array(0); + } idx = subs.length - 1; //if(!_.any(subs, function(cfg) { return cfg === subDef; })) { @@ -277,12 +254,6 @@ var localBus = { //} }, - notifyTaps: function(data, envelope) { - _.each(this.wireTaps,function(tap) { - tap(data, envelope); - }); - }, - unsubscribe: function(config) { if(this.subscriptions[config.exchange][config.topic]) { var len = this.subscriptions[config.exchange][config.topic].length, @@ -308,30 +279,42 @@ var localBus = { } }; +var publishPicker = { + "2" : function(envelope, payload) { + if(!envelope.exchange) { + envelope.exchange = DEFAULT_EXCHANGE; + } + postal.configuration.bus.publish(envelope, payload); + }, + "3" : function(exchange, topic, payload) { + postal.configuration.bus.publish({ exchange: exchange, topic: topic }, payload); + } +}; + var postal = { configuration: { bus: localBus, resolver: bindingsResolver }, - channel: function(exchange, topic) { - var exch = topic ? exchange : DEFAULT_EXCHANGE, - tpc = topic || exchange; + channel: function(options) { + var exch = options.exchange || DEFAULT_EXCHANGE, + tpc = options.topic; return new ChannelDefinition(exch, tpc); }, - subscribe: function(exchange, topic, callback) { - var callbk = callback || topic, - tpc = callback ? topic : exchange, - exch = callback ? exchange : DEFAULT_EXCHANGE; - var channel = this.channel(exch, tpc); - return channel.subscribe(callbk); + subscribe: function(options) { + var callback = options.callback, + topic = options.topic, + exchange = options.exchange || DEFAULT_EXCHANGE; + return new ChannelDefinition(exchange, topic).subscribe(callback); }, - publish: function(exchange, topic, payload, envelopeOptions) { - var parsedArgs = parsePublishArgs([].slice.call(arguments,0)); - var channel = this.channel(parsedArgs.envelope.exchange, parsedArgs.envelope.topic); - channel.publish(parsedArgs.payload, parsedArgs.envelope); + publish: function() { + var len = arguments.length; + if(publishPicker[len]) { + publishPicker[len].apply(this, arguments); + } }, addWireTap: function(callback) { @@ -339,21 +322,28 @@ var postal = { }, bindExchanges: function(sources, destinations) { - var subscriptions = []; + var subscriptions; if(!_.isArray(sources)) { sources = [sources]; } if(!_.isArray(destinations)) { destinations = [destinations]; } + subscriptions = new Array(sources.length * destinations.length); _.each(sources, function(source){ var sourceTopic = source.topic || "*"; _.each(destinations, function(destination) { var destExchange = destination.exchange || DEFAULT_EXCHANGE; subscriptions.push( - postal.subscribe(source.exchange || DEFAULT_EXCHANGE, source.topic || "*", function(msg, env) { - var destTopic = _.isFunction(destination.topic) ? destination.topic(env.topic) : destination.topic || env.topic; - postal.publish(destExchange, destTopic, msg); + postal.subscribe({ + exchange: source.exchange || DEFAULT_EXCHANGE, + topic: source.topic || "*", + callback : function(msg, env) { + var newEnv = env; + newEnv.topic = _.isFunction(destination.topic) ? destination.topic(env.topic) : destination.topic || env.topic; + newEnv.exchange = destExchange; + postal.publish(newEnv, msg); + } }) ); }); diff --git a/lib/browser/amd/postal.min.gz.js b/lib/browser/amd/postal.min.gz.js index 6d503d28a633eec99f122b5c3d4b3be5f0dc6572..df515675f07a9907230e3562c06b38941aa2cb20 100644 GIT binary patch literal 1543 zcmV+i2Kf0OiwFR2Hcw9g1HD*VZ`(E${ws<$xMD)9&W1hADpwS3hP|vS)?fqXW&m%p z)yR@6QMpvsf8U`*Nu=#u_R^O`yq)v$J6BrBILTzN^6N~T8COZ31r#+m zwDcJ9U;3DnpB7k<1(w7w@=DRv$1xfAqNc@bd)S?fN~!8H^Tv7JF9>pSKCIC&sXnSQ z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/postal.min.js b/lib/browser/amd/postal.min.js index 0059a3e..1a12081 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)},unsubscribe:function(a){if(this.subscriptions[a.exchange][a.topic]){var b=this.subscriptions[a.exchange][a.topic].length,c=0;for(;cjXLg diff --git a/lib/browser/standard/postal.js b/lib/browser/standard/postal.js index 4fc5ba3..be4fc1c 100644 --- a/lib/browser/standard/postal.js +++ b/lib/browser/standard/postal.js @@ -10,39 +10,7 @@ var DEFAULT_EXCHANGE = "/", DEFAULT_PRIORITY = 50, DEFAULT_DISPOSEAFTER = 0, SYSTEM_EXCHANGE = "postal", - NO_OP = function() { }, - parsePublishArgs = function(args) { - var parsed = { envelope: { } }, env; - switch(args.length) { - case 3: - if(typeof args[1] === "Object" && typeof args[2] === "Object") { - parsed.envelope.exchange = DEFAULT_EXCHANGE; - parsed.envelope.topic = args[0]; - parsed.payload = args[1]; - env = parsed.envelope; - parsed.envelope = _.extend(env, args[2]); - } - else { - parsed.envelope.exchange = args[0]; - parsed.envelope.topic = args[1]; - parsed.payload = args[2]; - } - break; - case 4: - parsed.envelope.exchange = args[0]; - parsed.envelope.topic = args[1]; - parsed.payload = args[2]; - env = parsed.envelope; - parsed.envelope = _.extend(env, args[3]); - break; - default: - parsed.envelope.exchange = DEFAULT_EXCHANGE; - parsed.envelope.topic = args[0]; - parsed.payload = args[1]; - break; - } - return parsed; - }; + NO_OP = function() { }; var DistinctPredicate = function() { var previous; @@ -73,12 +41,11 @@ ChannelDefinition.prototype = { }, publish: function(data, envelope) { - var env = _.extend({ - exchange: this.exchange, - timeStamp: new Date(), - topic: this.topic - }, envelope); - postal.configuration.bus.publish(data, env); + var env = envelope || {}; + env.exchange = this.exchange; + env.timeStamp = new Date(); + env.topic = this.topic; + postal.configuration.bus.publish(env, data); } }; @@ -87,12 +54,15 @@ var SubscriptionDefinition = function(exchange, topic, callback) { this.topic = topic; this.callback = callback; this.priority = DEFAULT_PRIORITY; - this.constraints = []; + this.constraints = new Array(0); this.maxCalls = DEFAULT_DISPOSEAFTER; this.onHandled = NO_OP; this.context = null; - postal.publish(SYSTEM_EXCHANGE, "subscription.created", + postal.publish({ + exchange: SYSTEM_EXCHANGE, + topic: "subscription.created" + }, { event: "subscription.created", exchange: exchange, @@ -103,7 +73,10 @@ var SubscriptionDefinition = function(exchange, topic, callback) { SubscriptionDefinition.prototype = { unsubscribe: function() { postal.configuration.bus.unsubscribe(this); - postal.publish(SYSTEM_EXCHANGE, "subscription.removed", + postal.publish({ + exchange: SYSTEM_EXCHANGE, + topic: "subscription.removed" + }, { event: "subscription.removed", exchange: this.exchange, @@ -215,7 +188,10 @@ var bindingsResolver = { if(this.cache[topic] && this.cache[topic][binding]) { return true; } - var rgx = new RegExp("^" + this.regexify(binding) + "$"), // match from start to end of string + // binding.replace(/\./g,"\\.") // escape actual periods + // .replace(/\*/g, ".*") // asterisks match any value + // .replace(/#/g, "[A-Z,a-z,0-9]*"); // hash matches any alpha-numeric 'word' + var rgx = new RegExp("^" + binding.replace(/\./g,"\\.").replace(/\*/g, ".*").replace(/#/g, "[A-Z,a-z,0-9]*") + "$"), result = rgx.test(topic); if(result) { if(!this.cache[topic]) { @@ -224,12 +200,6 @@ var bindingsResolver = { this.cache[topic][binding] = true; } return result; - }, - - regexify: function(binding) { - return binding.replace(/\./g,"\\.") // escape actual periods - .replace(/\*/g, ".*") // asterisks match any value - .replace(/#/g, "[A-Z,a-z,0-9]*"); // hash matches any alpha-numeric 'word' } }; @@ -237,10 +207,12 @@ var localBus = { subscriptions: {}, - wireTaps: [], + wireTaps: new Array(0), - publish: function(data, envelope) { - this.notifyTaps(data, envelope); + publish: function(envelope, data) { + _.each(this.wireTaps,function(tap) { + tap(envelope, data); + }); _.each(this.subscriptions[envelope.exchange], function(topic) { _.each(topic, function(binding){ @@ -257,10 +229,15 @@ var localBus = { }, subscribe: function(subDef) { - var idx, found, fn, exch, subs; + var idx, found, fn, exch = this.subscriptions[subDef.exchange], subs; - exch = this.subscriptions[subDef.exchange] = this.subscriptions[subDef.exchange] || {}; - subs = this.subscriptions[subDef.exchange][subDef.topic] = this.subscriptions[subDef.exchange][subDef.topic] || []; + if(!exch) { + exch = this.subscriptions[subDef.exchange] = {}; + } + subs = this.subscriptions[subDef.exchange][subDef.topic] + if(!subs) { + subs = this.subscriptions[subDef.exchange][subDef.topic] = new Array(0); + } idx = subs.length - 1; //if(!_.any(subs, function(cfg) { return cfg === subDef; })) { @@ -277,12 +254,6 @@ var localBus = { //} }, - notifyTaps: function(data, envelope) { - _.each(this.wireTaps,function(tap) { - tap(data, envelope); - }); - }, - unsubscribe: function(config) { if(this.subscriptions[config.exchange][config.topic]) { var len = this.subscriptions[config.exchange][config.topic].length, @@ -308,30 +279,42 @@ var localBus = { } }; +var publishPicker = { + "2" : function(envelope, payload) { + if(!envelope.exchange) { + envelope.exchange = DEFAULT_EXCHANGE; + } + postal.configuration.bus.publish(envelope, payload); + }, + "3" : function(exchange, topic, payload) { + postal.configuration.bus.publish({ exchange: exchange, topic: topic }, payload); + } +}; + var postal = { configuration: { bus: localBus, resolver: bindingsResolver }, - channel: function(exchange, topic) { - var exch = topic ? exchange : DEFAULT_EXCHANGE, - tpc = topic || exchange; + channel: function(options) { + var exch = options.exchange || DEFAULT_EXCHANGE, + tpc = options.topic; return new ChannelDefinition(exch, tpc); }, - subscribe: function(exchange, topic, callback) { - var callbk = callback || topic, - tpc = callback ? topic : exchange, - exch = callback ? exchange : DEFAULT_EXCHANGE; - var channel = this.channel(exch, tpc); - return channel.subscribe(callbk); + subscribe: function(options) { + var callback = options.callback, + topic = options.topic, + exchange = options.exchange || DEFAULT_EXCHANGE; + return new ChannelDefinition(exchange, topic).subscribe(callback); }, - publish: function(exchange, topic, payload, envelopeOptions) { - var parsedArgs = parsePublishArgs([].slice.call(arguments,0)); - var channel = this.channel(parsedArgs.envelope.exchange, parsedArgs.envelope.topic); - channel.publish(parsedArgs.payload, parsedArgs.envelope); + publish: function() { + var len = arguments.length; + if(publishPicker[len]) { + publishPicker[len].apply(this, arguments); + } }, addWireTap: function(callback) { @@ -339,21 +322,28 @@ var postal = { }, bindExchanges: function(sources, destinations) { - var subscriptions = []; + var subscriptions; if(!_.isArray(sources)) { sources = [sources]; } if(!_.isArray(destinations)) { destinations = [destinations]; } + subscriptions = new Array(sources.length * destinations.length); _.each(sources, function(source){ var sourceTopic = source.topic || "*"; _.each(destinations, function(destination) { var destExchange = destination.exchange || DEFAULT_EXCHANGE; subscriptions.push( - postal.subscribe(source.exchange || DEFAULT_EXCHANGE, source.topic || "*", function(msg, env) { - var destTopic = _.isFunction(destination.topic) ? destination.topic(env.topic) : destination.topic || env.topic; - postal.publish(destExchange, destTopic, msg); + postal.subscribe({ + exchange: source.exchange || DEFAULT_EXCHANGE, + topic: source.topic || "*", + callback : function(msg, env) { + var newEnv = env; + newEnv.topic = _.isFunction(destination.topic) ? destination.topic(env.topic) : destination.topic || env.topic; + newEnv.exchange = destExchange; + postal.publish(newEnv, msg); + } }) ); }); diff --git a/lib/browser/standard/postal.min.gz.js b/lib/browser/standard/postal.min.gz.js index e82d604fcafc278635b1330c0da65e2c7ac2dc44..1b07ad7c97404363fb637d45ddb1ccc4c4955db6 100644 GIT binary patch literal 1516 zcmVYt1+BhITt*{^~ z91=TA3rS-eZ%8kVsv2+2q1s9PT*xv{tbV>%d2-&ZUAs~7QRY#yfz{UzCyWq6F(nLn zFjC7GUrHJ~3{wQt*DjCKM1U~DC%mq4M8=rqHY!|k$G0@u2+-7wWtv5xy7nVC%Tt-k z`%I9kC|SYthzV~{(IR9d5qs;iGg4-#0xaDH5|^h*7;Va&Dh)0x3%6GcFfprfR~N@RpAV47XL46YJMmG{UDjZFM`bhFT*v@42SXq0D7ba)tMfjO*uwlcU+sX? zIA)aJ5Z;cnJWBIO-jhJDr%54m8YQx5Ail|Sdhe`IySk%yZ$UvpG=FLG8%=^(1Z2~1 zm*P&6q>N*@MhCj;FnJ+v;CQyCHES-&a{*KYc8x1>D-!w0GVaw-t%lX8_CK3`P$n~; zfT}r44bjFq(EmW3i(PvAIO1-3Ks@ojM&)20xCRbHC~|KacVuL?&QZsZ~I7bR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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_!vE3;|kmXdy~$bXQy*ehAGO36l$!Q zpxz!Pa&L?KJoOT&z3`k=Br^*YY`|yK<5&;|6YQ|0L5;nFHVgrAbxJWmSPOr1U;ZTPoW8G8o=PH^?&|ZGztN?!XW-Vj{I;~PDH<*8(io?#~w^T2TRa+sZA|4jh|~9%30)B>$!0a+7czI@8OZk6qS(` zTMuP@I?Q!Y>1eHM`-SamK86qfogm0q|LdCjK^K#$;TLK$U{kE2RqevvLnZ@o-v-X~ xkG?-3kM(ji#UGbM0R>q#gSK`=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)},unsubscribe:function(a){if(this.subscriptions[a.exchange][a.topic]){var b=this.subscriptions[a.exchange][a.topic].length,c=0;for(;c