diff options
Diffstat (limited to 'lib/handler_stack.coffee')
| -rw-r--r-- | lib/handler_stack.coffee | 10 | 
1 files changed, 10 insertions, 0 deletions
| diff --git a/lib/handler_stack.coffee b/lib/handler_stack.coffee index f56683f1..764461e7 100644 --- a/lib/handler_stack.coffee +++ b/lib/handler_stack.coffee @@ -6,6 +6,7 @@ class HandlerStack      @stack = []      @counter = 0      @passDirectlyToPage = new Object() # Used only as a constant, distinct from any other value. +    @eventConsumed = new Object() # Used only as a constant, distinct from any other value.    genId: -> @counter = ++@counter @@ -32,6 +33,10 @@ class HandlerStack          # event through to the underlying page.  The event is not suppresssed.          if passThrough == @passDirectlyToPage            return false +        # If the constant @eventConsumed is returned, then discontinue further bubbling and +        # return false. +        if passThrough == @eventConsumed +          return false      true    remove: (id = @currentId) -> @@ -51,5 +56,10 @@ class HandlerStack      handler()      true +  # Convenience wrapper for handlers which never continue propagation. +  neverPropagate: (handler) -> +    handler() +    false +  root.HandlerStack = HandlerStack  root.handlerStack = new HandlerStack | 
