aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/mode.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-01-18 06:27:38 +0000
committerStephen Blott2015-01-18 10:25:31 +0000
commit0e59b99e95e6a4fd3f64fd284e7417ba5f7e22e1 (patch)
tree19fddb33de1e00b8024c4cb5c86dc483169da885 /content_scripts/mode.coffee
parent9cb0f2853a155e39270282e6ed224966afffc61e (diff)
downloadvimium-0e59b99e95e6a4fd3f64fd284e7417ba5f7e22e1.tar.bz2
Modes; pre-merge clean up.
Diffstat (limited to 'content_scripts/mode.coffee')
-rw-r--r--content_scripts/mode.coffee15
1 files changed, 8 insertions, 7 deletions
diff --git a/content_scripts/mode.coffee b/content_scripts/mode.coffee
index 2ff71ca8..a74acfed 100644
--- a/content_scripts/mode.coffee
+++ b/content_scripts/mode.coffee
@@ -24,8 +24,10 @@
# responds to "focus" events, then push an additional handler:
# @push
# "focus": (event) => ....
-# Any such handlers are removed when the mode is deactivated.
+# Such handlers are removed when the mode is deactivated.
#
+# The following events can be handled:
+# keydown, keypress, keyup, click, focus and blur
# Debug only.
count = 0
@@ -85,8 +87,8 @@ class Mode
"click": (event) => @alwaysContinueBubbling => @exit event
# Some modes are singletons: there may be at most one instance active at any time. A mode is a singleton
- # if @options.singleton is truthy. The value of @options.singleton should be the key the which is
- # intended to be unique. New instances deactivate existing instances with the same key.
+ # if @options.singleton is truthy. The value of @options.singleton should be the key which is intended to
+ # be unique. New instances deactivate existing instances with the same key.
if @options.singleton
do =>
singletons = Mode.singletons ||= {}
@@ -99,7 +101,7 @@ class Mode
# If @options.trackState is truthy, then the mode mainatins the current state in @enabled and @passKeys,
# and calls @registerStateChange() (if defined) whenever the state changes. The mode also tracks the
- # keyQueue in @keyQueue.
+ # current keyQueue in @keyQueue.
if @options.trackState
@enabled = false
@passKeys = ""
@@ -115,7 +117,7 @@ class Mode
Mode.modes.push @
Mode.updateBadge()
- @logStack()
+ @logModes()
# End of Mode constructor.
push: (handlers) ->
@@ -124,7 +126,6 @@ class Mode
unshift: (handlers) ->
handlers._name ||= "mode-#{@id}"
- handlers._name += "/unshifted"
@handlers.push handlerStack.unshift handlers
onExit: (handler) ->
@@ -160,7 +161,7 @@ class Mode
badge: badge.badge
# Debugging routines.
- logStack: ->
+ logModes: ->
if @debug
@log "active modes (top to bottom):"
@log " ", mode.id for mode in Mode.modes[..].reverse()