Remove the core/pubsub module, as it does not appear to be needed

Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/b47d9ec1
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/b47d9ec1
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/b47d9ec1

Branch: refs/heads/master
Commit: b47d9ec1499e31037fdb72e729d62b4f59e1a00a
Parents: 61c9aba
Author: Howard M. Lewis Ship <[email protected]>
Authored: Mon Dec 17 09:57:17 2012 -0800
Committer: Howard M. Lewis Ship <[email protected]>
Committed: Mon Dec 17 09:57:17 2012 -0800

----------------------------------------------------------------------
 .../META-INF/modules/core/pubsub.coffee            |  158 ---------------
 .../integration/app1/pages/test-pubsub.coffee      |   84 --------
 .../integration/app1/pages/JavaScriptTests.java    |    1 -
 3 files changed, 0 insertions(+), 243 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/b47d9ec1/tapestry-core/src/main/coffeescript/META-INF/modules/core/pubsub.coffee
----------------------------------------------------------------------
diff --git 
a/tapestry-core/src/main/coffeescript/META-INF/modules/core/pubsub.coffee 
b/tapestry-core/src/main/coffeescript/META-INF/modules/core/pubsub.coffee
deleted file mode 100644
index 8f3a65b..0000000
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/core/pubsub.coffee
+++ /dev/null
@@ -1,158 +0,0 @@
-# Copyright 2012 The Apache Software Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http:#www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# ## core/pubsub
-#
-# Framework/application publish and subscribe that is independent of
-# the DOM. Parts of this are modelled on how jQuery DOM events work.
-define ["_"],
-  (_) ->
-
-    exports = {}
-
-    subscribers = { }
-
-    kullSubs = (name, namespaces, responder) ->
-      list = subscribers[name]
-      return if list is null
-
-      # Work backwards to avoid excessive copies
-      for i in [list.length - 1 .. 0]
-        subscriber = list[i]
-        # TODO: _.intersection is expensive
-        if (!responder or subscriber.fn is responder) and
-           (namespaces.length == 0 or _.intersection(namespaces, 
subscriber.namespaces).length > 0)
-          if list.iterating
-            subscribers[name] = list = list[..]
-          list.splice i, 1
-
-      return
-
-    addSub = (stimulusName, addFirst, responder) ->
-      [simpleName, namespaces...] = stimulusName.split '.'
-
-      subscriber =
-        stimulus: simpleName
-        namespaces: namespaces
-        fn: responder
-
-      list = subscribers[simpleName]
-
-      if not list
-        subscribers[simpleName] = [subscriber]
-      else
-        # If iterating the list (during a publish), then do a copy-on-write.
-        # This allows a clean way to have listeners unsubscribe one first 
notification, or
-        # otherwise change the subscriptions.
-        if list.iterating
-          subscribers[simpleName] = list = list.slice[..]
-
-        list[if addFirst then "unshift" else "push"] subscriber
-
-      return
-
-    # Adds a responder for a stimulus.  The stimulus name consists of a simple 
topic name
-    # (used when publishing a message), and optional set of namespaces; each 
namespace
-    # is preceded by a '.'.  The namespaces make it easier to identify 
specific responders
-    # later, such as when removing a responder.
-    # The ordering identifies where the listener will be placed.
-    # The listenerfn is a function to be invoked via the publisher. A topic 
publisher
-    # will publish a message with an application-specific memo.  The 
listenerfn receives
-    # the memo parameter, and an event parameter.  The event parameter allows 
the
-    # message to be terminated early.
-    #
-    # * stimulus - name of stimulus to respond to, with namespaces appended
-    # * responder - function to be invoked when the stimulus is fired. The 
responder
-    # is passed a memo object, and an event. The event can be used to cancel or
-    # pause the stimulus.
-    #
-    # Returns this module's exports, for easy chaining of calls.
-    exports.respondTo = exports.on = (stimulusName, responder) ->
-
-      addSub stimulusName, false, responder
-
-      return exports
-
-    # Adds a responder for a stimulus, but the responder is added first in the 
list.
-    # Otherwise, the same as `respondTo()`.
-    # Returns this module's exports, for easy chaining of calls.
-    exports.respondFirst = exports.first = (stimulusName, responder) ->
-      addSub stimulusName, true, responder
-
-      return exports
-
-    # Stops responding to a stimulus. The parameters identify zero or more 
responders
-    # that will no longer be triggered.
-    # Only previously added responders that match a specifically as possible 
will be removed.
-    # If a responder is provided, it must match exactly.
-    # If a stimulus name is provided, the name must match exactly.
-    # If any namespaces were provided, then at least ONE namespace must match 
a namespace provided when
-    # the responder was added.
-    #
-    # * stimulusName - optional, identifies a stimulus and optional namespaces
-    # * responder - optional, identifies a specific responder to remove
-    #
-    # Returns this module's exports, to support chaining.
-    exports.stopResponding = exports.off = (stimulusName = "", responder) ->
-      if _.isFunction stimulusName
-        responder = stimulusName
-        stimulusName = ""
-
-      [simpleName, namespaces...] = stimulusName.split '.'
-
-      if simpleName isnt ""
-        kullSubs simpleName, namespaces, responder
-      else
-        kullSubs name, namespaces, responder for name of subscribers
-
-      return exports
-
-
-    # Fires the stimulus, passing the memo and an event to each responder that 
was previously added.
-    # The event can be used to terminate the stimular prematurely, via its 
stop() method.
-    # The context object defines the value of this for
-    # the invoked responders; it is often null (or omitted).
-    # stimulusName - simple name of stimulus to fire (it should not contain 
namespaces)
-    #
-    # * memo - object to be passed to each responder (as the first parameter)
-    # * context - context value (this) used when invoking responders
-    #
-    # Returns this module's exports, to support chaining.
-    exports.fire = (stimulusName, memo, context) ->
-      list = subscribers[stimulusName]
-
-      return exports if not list
-
-      event =
-        memo: memo
-        running: true
-        stimulus: stimulusName
-        stop: -> running = false
-        # TODO: pause and resume
-
-      try
-        wasIterating = list.iterating
-        list.iterating = true
-
-        for subscriber in list when event.running
-          # Pass the memo and the event to the responder.
-          subscriber.fn.call context, memo, event
-
-      finally
-        list.iterating = wasIterating
-
-      return exports
-
-    # Result of define:
-    return exports

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/b47d9ec1/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/test-pubsub.coffee
----------------------------------------------------------------------
diff --git 
a/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/test-pubsub.coffee
 
b/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/test-pubsub.coffee
deleted file mode 100644
index c0e3b71..0000000
--- 
a/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/test-pubsub.coffee
+++ /dev/null
@@ -1,84 +0,0 @@
-require ["core/pubsub"], (pubsub) ->
-  module "core/pubsub"
-
-  test "export aliases", ->
-    ok pubsub.on is pubsub.respondTo, "on and respondTo"
-    ok pubsub.off is pubsub.stopResponding, "off and stopResponding"
-    ok pubsub.first is pubsub.respondFirst, "first and respondFirst"
-
-  test "simple on/fire", ->
-    memoValue = null
-    expectedMemo = "expected"
-
-    pubsub.on "stim", (memo) -> memoValue = memo
-    pubsub.fire "stim", expectedMemo
-
-    ok memoValue is expectedMemo, "responder function was invoked"
-
-  test "stopResponding, match by responder", ->
-    count = 0
-
-    responder = -> count++
-
-    pubsub.on "stim", responder
-    pubsub.fire "stim"
-
-    equal count, 1, "responder invoked on first fire"
-
-    pubsub.off null, responder
-    pubsub.fire "stim"
-
-    equal count, 1, "responder not invoked after removal"
-
-  test "stopResponding, match by namespace name", ->
-    log = []
-
-    a = (memo) -> log.push "a:#{memo}"
-    b = (memo) -> log.push "b:#{memo}"
-
-    pubsub.on "stim.a", a
-    pubsub.on "stim.b", b
-
-    pubsub.fire "stim", "first"
-
-    deepEqual log, ["a:first", "b:first"], "both responders invoked"
-
-    log.length = 0
-
-    pubsub.off ".a"
-    pubsub.fire "stim", "second"
-
-    deepEqual log, ["b:second"], "only second responder invoked after .a 
removal"
-
-  test "stopResponding, match by stimulus name", ->
-    log = []
-
-    a = (memo, event) -> log.push "a:#{event.stimulus}-#{memo}"
-    b = (memo, event) -> log.push "b:#{event.stimulus}-#{memo}"
-    c = (memo, event) -> log.push "c:#{event.stimulus}-#{memo}"
-
-    pubsub.on("alpha", a).on("beta", b).on("alpha", c)
-
-    pubsub.fire "alpha", "one"
-    pubsub.fire "beta", "first"
-
-    deepEqual log, ["a:alpha-one", "c:alpha-one", "b:beta-first"], "all 
responders invoked"
-
-    log.length = 0
-
-    pubsub.off "alpha"
-
-    pubsub.fire "alpha", "two"
-    pubsub.fire "beta", "second"
-
-    deepEqual log, ["b:beta-second"], "only 'beta' responder invoked after 
removal"
-
-  test "respondFirst is invoked first", ->
-    log = []
-
-    pubsub.on "stim", -> log.push "alpha"
-    pubsub.first "stim", -> log.push "bravo"
-
-    pubsub.fire "stim"
-
-    deepEqual log, ["bravo", "alpha"], "first responder invoked first"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/b47d9ec1/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.java
----------------------------------------------------------------------
diff --git 
a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.java
 
b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.java
index ca0e1f7..88127f7 100644
--- 
a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.java
+++ 
b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.java
@@ -6,7 +6,6 @@ import org.apache.tapestry5.annotations.Import;
         "context:qunit/qunit-1.9.0.js",
         "qunit-config.js",
 
-        "test-pubsub.js",
         "test-dom.js",
         "test-messages.js",
         "test-validation.js",

Reply via email to