aboutsummaryrefslogtreecommitdiffstats
path: root/lib/handler_stack.coffee
diff options
context:
space:
mode:
authorStephen Blott2014-12-31 20:52:27 +0000
committerStephen Blott2015-01-01 09:37:20 +0000
commitacefe43cef5a216cb2504e85799699c359b6b4d8 (patch)
tree280e4d312cab11eb3b825b1fde73fc0654955e82 /lib/handler_stack.coffee
parentf2b428b4fe1eecd66ee95513da779470f7c621aa (diff)
downloadvimium-acefe43cef5a216cb2504e85799699c359b6b4d8.tar.bz2
Modes; incorporate three test modes.
As a proof of concept, this incorporates normal mode, passkeys mode and insert mode.
Diffstat (limited to 'lib/handler_stack.coffee')
-rw-r--r--lib/handler_stack.coffee10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/handler_stack.coffee b/lib/handler_stack.coffee
index 728ea4bc..1c334210 100644
--- a/lib/handler_stack.coffee
+++ b/lib/handler_stack.coffee
@@ -1,11 +1,11 @@
root = exports ? window
-class root.HandlerStack
+class HandlerStack
constructor: ->
@stack = []
@counter = 0
- @passThrough = {}
+ @passThrough = new Object() # Used only as a constant, distinct from any other value.
genId: -> @counter = ++@counter & 0xffff
@@ -19,7 +19,6 @@ class root.HandlerStack
# propagation by returning a falsy value.
bubbleEvent: (type, event) ->
for i in [(@stack.length - 1)..0] by -1
- console.log i, type
handler = @stack[i]
# We need to check for existence of handler because the last function call may have caused the release
# of more than one handler.
@@ -29,8 +28,8 @@ class root.HandlerStack
if not passThrough
DomUtils.suppressEvent(event)
return false
- # If @passThrough is returned, then discontinue further bubbling and pass the event through to the
- # underlying page. The event is not suppresssed.
+ # If the constant @passThrough is returned, then discontinue further bubbling and pass the event
+ # through to the underlying page. The event is not suppresssed.
if passThrough == @passThrough
return false
true
@@ -42,4 +41,5 @@ class root.HandlerStack
@stack.splice(i, 1)
break
+root. HandlerStack = HandlerStack
root.handlerStack = new HandlerStack