aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorStephen Blott2015-01-02 15:59:58 +0000
committerStephen Blott2015-01-02 17:17:34 +0000
commit2d8c478e8086abf80b206d0fd8abc488a035b5cd (patch)
tree6587ee3d4f11aef54b5a2c5ccb0989307f865eeb /lib
parentb7d5e25e353010505db7754e97d4387c8aa6b8fc (diff)
downloadvimium-2d8c478e8086abf80b206d0fd8abc488a035b5cd.tar.bz2
Modes; incorporate find mode.
Diffstat (limited to 'lib')
-rw-r--r--lib/handler_stack.coffee10
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