From 18ee34b4f8109af234a4bd4fa01875961d173fba Mon Sep 17 00:00:00 2001 From: Jim Cowart Date: Fri, 9 Sep 2011 01:23:07 -0400 Subject: [PATCH] Moving new code base into separate files, creating tests, archiving old code base until refactor is complete. --- spec/BindingsResolver.spec.js | 55 +++++++ spec/ChannelDefinition.spec.js | 151 +++++++++++++++++++ spec/DistinctPredicate.spec.js | 76 ++++++++++ spec/{ => Old}/broker.spec.js | 0 spec/{ => Old}/broker.withCapture.spec.js | 0 spec/{ => Old}/broker.withReplay.spec.js | 0 spec/Old/postal.core.html | 24 ++++ spec/Old/postal.withCapture.html | 27 ++++ spec/Old/postal.withCapture_Replay.html | 28 ++++ spec/Old/postal.withReplay.html | 26 ++++ spec/Old/runner.html | 19 +++ spec/{ => Old}/testSetup.js | 0 spec/postal.core.html | 24 ---- spec/postal.withCapture.html | 27 ---- spec/postal.withCapture_Replay.html | 28 ---- spec/postal.withReplay.html | 26 ---- spec/runner.html | 30 ++-- src/BindingsResolver.js | 14 ++ src/Bus.new.js | 167 ++-------------------- src/ChannelDefinition.js | 121 ++++++++++++++++ src/DistinctPredicate.js | 8 ++ src/{ => old}/Bus.js | 0 src/{ => old}/Diagnostics.js | 0 src/{ => old}/Postal.js | 0 src/{ => old}/capture/CaptorPanel.js | 0 src/{ => old}/capture/MessageCaptor.js | 0 src/{ => old}/capture/panel.html | 0 src/{ => old}/misc.js | 0 src/{ => old}/replay/ReplayContext.js | 0 src/{ => old}/replay/ReplayPanel.js | 0 src/{ => old}/replay/panel.html | 0 31 files changed, 578 insertions(+), 273 deletions(-) create mode 100644 spec/BindingsResolver.spec.js create mode 100644 spec/ChannelDefinition.spec.js create mode 100644 spec/DistinctPredicate.spec.js rename spec/{ => Old}/broker.spec.js (100%) rename spec/{ => Old}/broker.withCapture.spec.js (100%) rename spec/{ => Old}/broker.withReplay.spec.js (100%) create mode 100644 spec/Old/postal.core.html create mode 100644 spec/Old/postal.withCapture.html create mode 100644 spec/Old/postal.withCapture_Replay.html create mode 100644 spec/Old/postal.withReplay.html create mode 100644 spec/Old/runner.html rename spec/{ => Old}/testSetup.js (100%) delete mode 100644 spec/postal.core.html delete mode 100644 spec/postal.withCapture.html delete mode 100644 spec/postal.withCapture_Replay.html delete mode 100644 spec/postal.withReplay.html create mode 100644 src/BindingsResolver.js create mode 100644 src/ChannelDefinition.js create mode 100644 src/DistinctPredicate.js rename src/{ => old}/Bus.js (100%) rename src/{ => old}/Diagnostics.js (100%) rename src/{ => old}/Postal.js (100%) rename src/{ => old}/capture/CaptorPanel.js (100%) rename src/{ => old}/capture/MessageCaptor.js (100%) rename src/{ => old}/capture/panel.html (100%) rename src/{ => old}/misc.js (100%) rename src/{ => old}/replay/ReplayContext.js (100%) rename src/{ => old}/replay/ReplayPanel.js (100%) rename src/{ => old}/replay/panel.html (100%) diff --git a/spec/BindingsResolver.spec.js b/spec/BindingsResolver.spec.js new file mode 100644 index 0000000..9a18eb4 --- /dev/null +++ b/spec/BindingsResolver.spec.js @@ -0,0 +1,55 @@ +QUnit.specify("postal.js", function(){ + describe("bindingsResolver", function(){ + describe("When calling regexify", function() { + describe("With a topic containing no special escape chars", function() { + var result = bindingsResolver.regexify("CoolTopic"); + console.log(result); + it("Should equal 'CoolTopic'", function(){ + assert(result).equals("CoolTopic"); + }); + }); + describe("With a topic containing periods", function() { + var result = bindingsResolver.regexify("Top.Middle.Bottom"); + console.log(result); + it("Only the periods should be escaped", function(){ + assert(result).equals("Top\\.Middle\\.Bottom"); + }); + }); + describe("With a topic containing a hash", function() { + var result = bindingsResolver.regexify("Top#Bottom"); + console.log(result); + it("Only the hash should be escaped", function(){ + assert(result).equals("Top[A-Z,a-z,0-9]*Bottom"); + }); + }); + describe("With a topic containing a hash and periods", function() { + var result = bindingsResolver.regexify("Top.#.Bottom"); + console.log(result); + it("The hash should be escaped for alphanumeric regex", function(){ + assert(result).equals("Top\\.[A-Z,a-z,0-9]*\\.Bottom"); + }); + }); + describe("With a topic containing a hash and asterisk", function() { + var result = bindingsResolver.regexify("Top#Bottom*"); + console.log(result); + it("The hash should be escaped for alphanumeric regex", function(){ + assert(result).equals("Top[A-Z,a-z,0-9]*Bottom.*"); + }); + }); + describe("With a topic containing a hash, asterisk and periods", function() { + var result = bindingsResolver.regexify("Top.#.Bottom.*"); + console.log(result); + it("The hash should be escaped for alphanumeric regex", function(){ + assert(result).equals("Top\\.[A-Z,a-z,0-9]*\\.Bottom\\..*"); + }); + }); + describe("With a topic containing an asterisk and periods", function() { + var result = bindingsResolver.regexify("Top.*.Bottom"); + console.log(result); + it("The asterisk should be escaped", function(){ + assert(result).equals("Top\\..*\\.Bottom"); + }); + }); + }); + }); +}); \ No newline at end of file diff --git a/spec/ChannelDefinition.spec.js b/spec/ChannelDefinition.spec.js new file mode 100644 index 0000000..ce40afa --- /dev/null +++ b/spec/ChannelDefinition.spec.js @@ -0,0 +1,151 @@ +QUnit.specify("postal.js", function(){ + + describe("ChannelDefinition", function(){ + describe("When initializing a basic channel definition", function() { + var chDef = new ChannelDefinition(); + + it("Should default the exchange", function() { + assert(chDef.configuration.exchange).equals(DEFAULT_EXCHANGE); + }); + it("Should default the topic", function() { + assert(chDef.configuration.topic).equals(""); + }); + it("Should default the callback", function() { + assert(chDef.configuration.callback).equals(NO_OP); + }); + it("Should default the priority", function() { + assert(chDef.configuration.priority).equals(DEFAULT_PRIORITY); + }); + it("Should default the constraints", function() { + assert(chDef.configuration.constraints.length).equals(0); + }); + it("Should default the disposeAfter", function() { + assert(chDef.configuration.disposeAfter).equals(DEFAULT_DISPOSEAFTER); + }); + it("Should default the onHandled", function() { + assert(chDef.configuration.onHandled).equals(NO_OP); + }); + it("Should default the onHandled", function() { + assert(chDef.configuration.context).isNull(); + }); + }); + + describe("When setting the exchange through fluent configuration", function(){ + var chDefe = new ChannelDefinition(); + chDefe.exchange("TestExchange"); + + it("Should set the exchange", function() { + assert(chDefe.configuration.exchange).equals("TestExchange"); + }); + }); + + describe("When setting the topic through fluent configuration", function(){ + var chDeft = new ChannelDefinition(); + chDeft.topic("TestTopic"); + + it("Should set the topic", function() { + assert(chDeft.configuration.topic).equals("TestTopic"); + }); + }); + + describe("When setting the definition to defer", function(){ + var chDefd = new ChannelDefinition(); + chDefd.defer(); + + it("Should set defer to true", function() { + assert(chDefd.configuration.defer).isTrue(); + }); + }); + + describe("When setting the definition to disposeAfter 2 invocations", function(){ + var chDefda = new ChannelDefinition(); + chDefda.disposeAfter(2); + + it("Should set disposeAfter to 2", function() { + assert(chDefda.configuration.disposeAfter).equals(2); + }); + }); + + describe("When setting ignoreDuplicates", function(){ + var chDefid = new ChannelDefinition(); + chDefid.ignoreDuplicates(); + + it("Should add a DistinctPredicate constraint to the configuration constraints", function() { + assert(chDefid.configuration.constraints.length).equals(1); + }); + }); + + describe("When setting whenHandledThenExecute", function(){ + var chDefwhte = new ChannelDefinition(); + chDefwhte.whenHandledThenExecute(function() { }); + + it("Should add an onHandled callback", function() { + assert(typeof chDefwhte.configuration.onHandled).equals("function"); + }); + }); + + describe("When adding a constraint", function(){ + var chDefc = new ChannelDefinition(); + chDefc.withConstraint(function() { }); + + it("Should add a constraint", function() { + assert(chDefc.configuration.constraints.length).equals(1); + }); + }); + + describe("When adding multiple constraints", function(){ + var chDefcs = new ChannelDefinition(); + chDefcs.withConstraints([function() { }, function() { }, function() { }]); + + it("Should add a constraint", function() { + assert(chDefcs.configuration.constraints.length).equals(3); + }); + }); + + describe("When setting the context", function(){ + var chDefctx = new ChannelDefinition(), + obj = {}; + chDefctx.withContext(obj); + + it("Should set context", function() { + assert(chDefctx.configuration.context).equals(obj); + }); + }); + + describe("When setting debounce", function(){ + var chDefdb = new ChannelDefinition(); + chDefdb.withDebounce(1000); + + it("Should set debounce", function() { + assert(chDefdb.configuration.debounce).equals(1000); + }); + }); + + describe("When setting delay", function(){ + var chDefdb = new ChannelDefinition(); + chDefdb.withDelay(1000); + + it("Should set delay", function() { + assert(chDefdb.configuration.delay).equals(1000); + }); + }); + + describe("When setting priority", function(){ + var chDefp = new ChannelDefinition(); + chDefp.withPriority(10); + + it("Should set priority", function() { + assert(chDefp.configuration.priority).equals(10); + }); + }); + + describe("When setting throttle", function(){ + var chDefth = new ChannelDefinition(); + chDefth.withThrottle(1000); + + it("Should set throttle", function() { + assert(chDefth.configuration.throttle).equals(1000); + }); + }); + }); +}); \ No newline at end of file diff --git a/spec/DistinctPredicate.spec.js b/spec/DistinctPredicate.spec.js new file mode 100644 index 0000000..b1df4f1 --- /dev/null +++ b/spec/DistinctPredicate.spec.js @@ -0,0 +1,76 @@ +QUnit.specify("postal.js", function(){ + describe("DistinctPredicate", function(){ + describe("When calling the function with the same data multiple times", function() { + var pred = new DistinctPredicate(), + data = { name: "Dr Who" }, + results = []; + results.push(pred(data)); + results.push(pred(data)); + results.push(pred(data)); + + it("The first result should be false", function(){ + assert(results[0]).isFalse(); + }); + it("The second result should be true", function(){ + assert(results[1]).isTrue(); + }); + it("The third result should be true", function(){ + assert(results[2]).isTrue(); + }); + }); + describe("When calling the function with different data every time", function() { + var predA = new DistinctPredicate(), + data = { name: "Amelia" }, + res = []; + res.push(predA(data)); + data.name = "Rose"; + res.push(predA(data)); + data.name = "Martha"; + res.push(predA(data)); + + it("The first result should be false", function(){ + assert(res[0]).isFalse(); + }); + it("The second result should be false", function(){ + assert(res[1]).isFalse(); + }); + it("The third result should be false", function(){ + assert(res[2]).isFalse(); + }); + }); + describe("When calling the function with different data every two calls", function() { + var predA = new DistinctPredicate(), + data = { name: "Amelia" }, + res = []; + res.push(predA(data)); + res.push(predA(data)); + data.name = "Rose"; + res.push(predA(data)); + res.push(predA(data)); + data.name = "Martha"; + res.push(predA(data)); + res.push(predA(data)); + + it("The first result should be false", function(){ + assert(res[0]).isFalse(); + }); + it("The second result should be true", function(){ + assert(res[1]).isTrue(); + }); + + it("The third result should be false", function(){ + assert(res[2]).isFalse(); + }); + it("The fourth result should be true", function(){ + assert(res[3]).isTrue(); + }); + + it("The fifth result should be false", function(){ + assert(res[4]).isFalse(); + }); + it("The sixth result should be true", function(){ + assert(res[5]).isTrue(); + }); + }); + }); +}); \ No newline at end of file diff --git a/spec/broker.spec.js b/spec/Old/broker.spec.js similarity index 100% rename from spec/broker.spec.js rename to spec/Old/broker.spec.js diff --git a/spec/broker.withCapture.spec.js b/spec/Old/broker.withCapture.spec.js similarity index 100% rename from spec/broker.withCapture.spec.js rename to spec/Old/broker.withCapture.spec.js diff --git a/spec/broker.withReplay.spec.js b/spec/Old/broker.withReplay.spec.js similarity index 100% rename from spec/broker.withReplay.spec.js rename to spec/Old/broker.withReplay.spec.js diff --git a/spec/Old/postal.core.html b/spec/Old/postal.core.html new file mode 100644 index 0000000..eacdb8a --- /dev/null +++ b/spec/Old/postal.core.html @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + +

+

+
+

+
    + + \ No newline at end of file diff --git a/spec/Old/postal.withCapture.html b/spec/Old/postal.withCapture.html new file mode 100644 index 0000000..9bc745f --- /dev/null +++ b/spec/Old/postal.withCapture.html @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + +

    +

    +
    +

    +
      + + \ No newline at end of file diff --git a/spec/Old/postal.withCapture_Replay.html b/spec/Old/postal.withCapture_Replay.html new file mode 100644 index 0000000..73fa607 --- /dev/null +++ b/spec/Old/postal.withCapture_Replay.html @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + +

      +

      +
      +

      +
        + + \ No newline at end of file diff --git a/spec/Old/postal.withReplay.html b/spec/Old/postal.withReplay.html new file mode 100644 index 0000000..8476953 --- /dev/null +++ b/spec/Old/postal.withReplay.html @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + +

        +

        +
        +

        +
          + + \ No newline at end of file diff --git a/spec/Old/runner.html b/spec/Old/runner.html new file mode 100644 index 0000000..76e5a01 --- /dev/null +++ b/spec/Old/runner.html @@ -0,0 +1,19 @@ + + + + + + + + + \ No newline at end of file diff --git a/spec/testSetup.js b/spec/Old/testSetup.js similarity index 100% rename from spec/testSetup.js rename to spec/Old/testSetup.js diff --git a/spec/postal.core.html b/spec/postal.core.html deleted file mode 100644 index 10b89fe..0000000 --- a/spec/postal.core.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - -

          -

          -
          -

          -
            - - \ No newline at end of file diff --git a/spec/postal.withCapture.html b/spec/postal.withCapture.html deleted file mode 100644 index c727dfb..0000000 --- a/spec/postal.withCapture.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -

            -

            -
            -

            -
              - - \ No newline at end of file diff --git a/spec/postal.withCapture_Replay.html b/spec/postal.withCapture_Replay.html deleted file mode 100644 index 6eaac61..0000000 --- a/spec/postal.withCapture_Replay.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -

              -

              -
              -

              -
                - - \ No newline at end of file diff --git a/spec/postal.withReplay.html b/spec/postal.withReplay.html deleted file mode 100644 index fbe349c..0000000 --- a/spec/postal.withReplay.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - -

                -

                -
                -

                -
                  - - \ No newline at end of file diff --git a/spec/runner.html b/spec/runner.html index 76e5a01..f0f65aa 100644 --- a/spec/runner.html +++ b/spec/runner.html @@ -1,19 +1,25 @@ - + + + + + + + + + + + + + - +

                  +

                  +
                  +

                  +
                    \ No newline at end of file diff --git a/src/BindingsResolver.js b/src/BindingsResolver.js new file mode 100644 index 0000000..1fd80f6 --- /dev/null +++ b/src/BindingsResolver.js @@ -0,0 +1,14 @@ +var bindingsResolver = { + cache: { }, + + compare: function(binding, topic) { + var rgx = new RegExp("^" + this.regexify(binding) + "$"); // match from start to end of string + return rgx.test(topic); + }, + + 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' + } +}; \ No newline at end of file diff --git a/src/Bus.new.js b/src/Bus.new.js index d72534e..40b444f 100644 --- a/src/Bus.new.js +++ b/src/Bus.new.js @@ -1,27 +1,10 @@ -var DEFAULT_EXCHANGE = "/", - DEFAULT_PRIORITY = 50, - DEFAULT_DISPOSEAFTER = 0, - NO_OP = function() { }, - bus; - -var bindingsResolver = { - cache: { }, - - compare: function(binding, topic) { - var rgx = new RegExp("^" + this.regexify(binding) + "$"); // match from start to end of string - return rgx.test(topic); - }, - - 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' - } -}; +var bus; var localBus = { subscriptions: {}, + wireTaps: [], + publish: function(envelope) { _.each(this.wireTaps,function(tap) { tap({ @@ -101,7 +84,13 @@ var localBus = { }, addWireTap: function(callback) { - console.log("WIRETAP: " + JSON.stringify(callback)); + this.wireTaps.push(callback); + return function() { + var idx = this.wireTaps.indexOf(callback); + if(idx !== -1) { + this.wireTaps.splice(idx,1); + } + }; } }; @@ -140,138 +129,4 @@ var postal = { } }; -postal.config.setBusBehavior(localBus); - -var ChannelDefinition = function(exchange, topic) { - this.configuration = { - exchange: exchange || DEFAULT_EXCHANGE, - topic: topic || "", - callback: NO_OP, - priority: DEFAULT_PRIORITY, - constraints: [], - disposeAfter: DEFAULT_DISPOSEAFTER, - onHandled: NO_OP, - context: null - }; -} ; - -ChannelDefinition.prototype = { - exchange: function(exchange) { - this.configuration.exchange = exchange; - return this; - }, - - topic: function(topic) { - this.configuration.topic = topic; - return this; - }, - - defer: function() { - this.configuration.defer = true; - return this; - }, - - disposeAfter: function(receiveCount) { - if(_.isNaN(receiveCount)) { - throw "The value provided to disposeAfter (receiveCount) must be a number"; - } - this.configuration.disposeAfter = receiveCount; - return this; - }, - - ignoreDuplicates: function() { - this.withConstraint(new DistinctPredicate()); - return this; - }, - - whenHandledThenExecute: function(callback) { - if(! _.isFunction(callback)) { - throw "Value provided to 'whenHandledThenExecute' must be a function"; - } - this.configuration.onHandled = callback; - return this; - }, - - withConstraint: function(predicate) { - if(! _.isFunction(predicate)) { - throw "Predicate constraint must be a function"; - } - this.configuration.constraints.push(predicate); - return this; - }, - - withConstraints: function(predicates) { - if(_.isArray(predicates)) { - _.each(predicates, function(predicate) { this.withConstraint(predicate); } ); - } - return this; - }, - - withContext: function(context) { - this.configuration.context = context; - return this; - }, - - withDebounce: function(milliseconds) { - if(_.isNaN(milliseconds)) { - throw "Milliseconds must be a number"; - } - this.configuration.debounce = milliseconds; - return this; - }, - - withDelay: function(milliseconds) { - if(_.isNaN(milliseconds)) { - throw "Milliseconds must be a number"; - } - this.configuration.delay = milliseconds; - return this; - }, - - withPriority: function(priority) { - if(_.isNaN(priority)) { - throw "Priority must be a number"; - } - this.configuration.priority = priority; - return this; - }, - - withThrottle: function(milliseconds) { - if(_.isNaN(milliseconds)) { - throw "Milliseconds must be a number"; - } - this.configuration.throttle = milliseconds; - return this; - }, - - subscribe: function(callback) { - this.configuration.callback = callback || NO_OP; - return postal.subscribe(this.configuration); - }, - - publish: function(data) { - postal.publish({ - exchange: this.configuration.exchange, - data: data, - topic: this.configuration.topic - }); - } -}; - -var DistinctPredicate = function() { - this.previous = undefined; - return function(data) { - var result = _.isEqual(data, this.previous); - this.previous = data; - return result; - } -}; - -/* - - postal.exchange("myExchange") - .topic("myTopic.mySubTopic") - .ignoreDuplicates() // is this the best name? - .withConstraint( function(data) { return data.firstName === "Jim"; }) - .subscribe(function() { }); -*/ \ No newline at end of file +postal.config.setBusBehavior(localBus); \ No newline at end of file diff --git a/src/ChannelDefinition.js b/src/ChannelDefinition.js new file mode 100644 index 0000000..3c1c839 --- /dev/null +++ b/src/ChannelDefinition.js @@ -0,0 +1,121 @@ +var DEFAULT_EXCHANGE = "/", + DEFAULT_PRIORITY = 50, + DEFAULT_DISPOSEAFTER = 0, + NO_OP = function() { }; + +var ChannelDefinition = function(exchange, topic) { + this.configuration = { + exchange: exchange || DEFAULT_EXCHANGE, + topic: topic || "", + callback: NO_OP, + priority: DEFAULT_PRIORITY, + constraints: [], + disposeAfter: DEFAULT_DISPOSEAFTER, + onHandled: NO_OP, + context: null + }; +} ; + +ChannelDefinition.prototype = { + exchange: function(exchange) { + this.configuration.exchange = exchange; + return this; + }, + + topic: function(topic) { + this.configuration.topic = topic; + return this; + }, + + defer: function() { + this.configuration.defer = true; + return this; + }, + + disposeAfter: function(receiveCount) { + if(_.isNaN(receiveCount)) { + throw "The value provided to disposeAfter (receiveCount) must be a number"; + } + this.configuration.disposeAfter = receiveCount; + return this; + }, + + ignoreDuplicates: function() { + this.withConstraint(new DistinctPredicate()); + return this; + }, + + whenHandledThenExecute: function(callback) { + if(! _.isFunction(callback)) { + throw "Value provided to 'whenHandledThenExecute' must be a function"; + } + this.configuration.onHandled = callback; + return this; + }, + + withConstraint: function(predicate) { + if(! _.isFunction(predicate)) { + throw "Predicate constraint must be a function"; + } + this.configuration.constraints.push(predicate); + return this; + }, + + withConstraints: function(predicates) { + var self = this; + if(_.isArray(predicates)) { + _.each(predicates, function(predicate) { self.withConstraint(predicate); } ); + } + return self; + }, + + withContext: function(context) { + this.configuration.context = context; + return this; + }, + + withDebounce: function(milliseconds) { + if(_.isNaN(milliseconds)) { + throw "Milliseconds must be a number"; + } + this.configuration.debounce = milliseconds; + return this; + }, + + withDelay: function(milliseconds) { + if(_.isNaN(milliseconds)) { + throw "Milliseconds must be a number"; + } + this.configuration.delay = milliseconds; + return this; + }, + + withPriority: function(priority) { + if(_.isNaN(priority)) { + throw "Priority must be a number"; + } + this.configuration.priority = priority; + return this; + }, + + withThrottle: function(milliseconds) { + if(_.isNaN(milliseconds)) { + throw "Milliseconds must be a number"; + } + this.configuration.throttle = milliseconds; + return this; + }, + + subscribe: function(callback) { + this.configuration.callback = callback || NO_OP; + return postal.subscribe(this.configuration); + }, + + publish: function(data) { + postal.publish({ + exchange: this.configuration.exchange, + data: data, + topic: this.configuration.topic + }); + } +}; \ No newline at end of file diff --git a/src/DistinctPredicate.js b/src/DistinctPredicate.js new file mode 100644 index 0000000..ddf29f4 --- /dev/null +++ b/src/DistinctPredicate.js @@ -0,0 +1,8 @@ +var DistinctPredicate = function() { + var previous; + return function(data) { + var result = _.isEqual(data, previous); + previous = _.clone(data); + return result; + }; +}; \ No newline at end of file diff --git a/src/Bus.js b/src/old/Bus.js similarity index 100% rename from src/Bus.js rename to src/old/Bus.js diff --git a/src/Diagnostics.js b/src/old/Diagnostics.js similarity index 100% rename from src/Diagnostics.js rename to src/old/Diagnostics.js diff --git a/src/Postal.js b/src/old/Postal.js similarity index 100% rename from src/Postal.js rename to src/old/Postal.js diff --git a/src/capture/CaptorPanel.js b/src/old/capture/CaptorPanel.js similarity index 100% rename from src/capture/CaptorPanel.js rename to src/old/capture/CaptorPanel.js diff --git a/src/capture/MessageCaptor.js b/src/old/capture/MessageCaptor.js similarity index 100% rename from src/capture/MessageCaptor.js rename to src/old/capture/MessageCaptor.js diff --git a/src/capture/panel.html b/src/old/capture/panel.html similarity index 100% rename from src/capture/panel.html rename to src/old/capture/panel.html diff --git a/src/misc.js b/src/old/misc.js similarity index 100% rename from src/misc.js rename to src/old/misc.js diff --git a/src/replay/ReplayContext.js b/src/old/replay/ReplayContext.js similarity index 100% rename from src/replay/ReplayContext.js rename to src/old/replay/ReplayContext.js diff --git a/src/replay/ReplayPanel.js b/src/old/replay/ReplayPanel.js similarity index 100% rename from src/replay/ReplayPanel.js rename to src/old/replay/ReplayPanel.js diff --git a/src/replay/panel.html b/src/old/replay/panel.html similarity index 100% rename from src/replay/panel.html rename to src/old/replay/panel.html