diff options
| author | Stephen Blott | 2015-01-06 10:52:13 +0000 |
|---|---|---|
| committer | Stephen Blott | 2015-01-06 11:14:59 +0000 |
| commit | b0f56ca439af45b62b23efd8c19c3838945f21f4 (patch) | |
| tree | 49eac8592cc1de0d2c33cd2030b551b09f3990d2 /content_scripts/mode.coffee | |
| parent | 3594bad00aec580bc837e2b2cc6d4051da149da0 (diff) | |
| download | vimium-b0f56ca439af45b62b23efd8c19c3838945f21f4.tar.bz2 | |
Modes; yet more minor tweeks.
Diffstat (limited to 'content_scripts/mode.coffee')
| -rw-r--r-- | content_scripts/mode.coffee | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/content_scripts/mode.coffee b/content_scripts/mode.coffee index b3cca56c..b81a4ede 100644 --- a/content_scripts/mode.coffee +++ b/content_scripts/mode.coffee @@ -67,6 +67,8 @@ class Mode console.log @count, "create:", @name @handlers = [] + @exitHandlers = [] + @push keydown: @keydown keypress: @keypress @@ -78,9 +80,13 @@ class Mode push: (handlers) -> @handlers.push handlerStack.push handlers + onExit: (handler) -> + @exitHandlers.push handler + exit: -> if @modeIsActive console.log @count, "exit:", @name + handler() for handler in @exitHandlers handlerStack.remove handlerId for handlerId in @handlers Mode.modes = Mode.modes.filter (mode) => mode != @ Mode.updateBadge() |
