diff options
| author | Phil Crosby | 2012-04-30 00:00:33 -0700 | 
|---|---|---|
| committer | Phil Crosby | 2012-05-05 18:32:10 -0700 | 
| commit | 55d13097c9ff8f6301a4bf64b42740ae5edcf71c (patch) | |
| tree | b9164e6b70af0d7641cd9d9f3382057711258f2e /lib/completion.js | |
| parent | 31a88a4dbff9456cef4500a2e9e100e0d87a060f (diff) | |
| download | vimium-55d13097c9ff8f6301a4bf64b42740ae5edcf71c.tar.bz2 | |
Shorten the declaration of async completer.
Diffstat (limited to 'lib/completion.js')
| -rw-r--r-- | lib/completion.js | 21 | 
1 files changed, 11 insertions, 10 deletions
| diff --git a/lib/completion.js b/lib/completion.js index e8365b9c..7e4bcf57 100644 --- a/lib/completion.js +++ b/lib/completion.js @@ -2,14 +2,15 @@ var completion = (function() {    /** Helper class to construct fuzzy completers for asynchronous data sources like history or bookmark     * matchers. */ -  var AsyncCompletionSource = function() { -    this.id = utils.createUniqueId(); -    this.reset(); -    this.resultsReady = this.fallbackReadyCallback = function(results) { -      this.completions = results; -    } -  } -  AsyncCompletionSource.prototype = { +  var AsyncCompletionSource = Class.extend({ +    init: function() { +      this.id = utils.createUniqueId(); +      this.reset(); +      this.resultsReady = this.fallbackReadyCallback = function(results) { +        this.completions = results; +      } +    }, +      reset: function() {        fuzzyMatcher.invalidateFilterCache(this.id);        this.completions = null; @@ -64,8 +65,8 @@ var completion = (function() {            self.resultsReady(results);          }        } -    }, -  } +    } +  });    /** A simple completer that suggests to open the input string as an URL or to trigger a web search for the     * given term, depending on whether it thinks the input is a URL or not. */ | 
