diff options
| author | Stephen Blott | 2016-04-17 16:11:57 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2016-04-17 16:11:57 +0100 | 
| commit | 5327d51946fa86ed494c7b5cd2ba39fb79d8e9e9 (patch) | |
| tree | ae04f84ab4ef959e9b403af9aa1c0b0da1d13c7c /content_scripts/hud.coffee | |
| parent | 12350784fc45998819ef92d6b5badf03e99128ae (diff) | |
| download | vimium-5327d51946fa86ed494c7b5cd2ba39fb79d8e9e9.tar.bz2 | |
Do not init() the HUD until it's needed.
This avoids initializing around 15 (almost all unused) HUDs on sites
like GMail and Google inbox.
Because the HUD is small, there is not noticable flicker.
Diffstat (limited to 'content_scripts/hud.coffee')
| -rw-r--r-- | content_scripts/hud.coffee | 8 | 
1 files changed, 3 insertions, 5 deletions
diff --git a/content_scripts/hud.coffee b/content_scripts/hud.coffee index 0bd1df3e..62bcf03f 100644 --- a/content_scripts/hud.coffee +++ b/content_scripts/hud.coffee @@ -23,13 +23,13 @@ HUD =      @_showForDurationTimerId = setTimeout((=> @hide()), duration)    show: (text) -> -    return unless @isReady() +    @init()      clearTimeout(@_showForDurationTimerId)      @hudUI.activate {name: "show", text}      @tween.fade 1.0, 150    showFindMode: (@findMode = null) -> -    return unless @isReady() +    @init()      @hudUI.activate name: "showFindMode"      @tween.fade 1.0, 150 @@ -46,7 +46,7 @@ HUD =    # If :updateIndicator is truthy, then we also refresh the mode indicator.  The only time we don't update the    # mode indicator, is when hide() is called for the mode indicator itself.    hide: (immediate = false, updateIndicator = true) -> -    return unless @tween? and @isReady() +    return unless @hudUI?.uiComponentIsReady      clearTimeout(@_showForDurationTimerId)      @tween.stop()      if immediate @@ -80,8 +80,6 @@ HUD =      @findMode.exit()      postExit?() -  isReady: -> @hudUI?.uiComponentIsReady -  class Tween    opacity: 0    intervalId: -1  | 
