aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content_scripts/mode.coffee19
1 files changed, 10 insertions, 9 deletions
diff --git a/content_scripts/mode.coffee b/content_scripts/mode.coffee
index 85187b2c..9de423ff 100644
--- a/content_scripts/mode.coffee
+++ b/content_scripts/mode.coffee
@@ -173,15 +173,16 @@ class Mode
@exitHandlers.push handler
exit: (args...) ->
- if @modeIsActive
- @log "deactivate:", @id
- unless @modeIsExiting
- @modeIsExiting = true
- handler args... for handler in @exitHandlers
- handlerStack.remove handlerId for handlerId in @handlers
- Mode.modes = Mode.modes.filter (mode) => mode != this
- @modeIsActive = false
- @setIndicator()
+ return if @modeIsExiting or not @modeIsActive
+ @log "deactivate:", @id
+ @modeIsExiting = true
+
+ handler args... for handler in @exitHandlers
+ handlerStack.remove handlerId for handlerId in @handlers
+ Mode.modes = Mode.modes.filter (mode) => mode != this
+
+ @modeIsActive = false
+ @setIndicator()
# Debugging routines.
logModes: ->