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 | |
| parent | 31a88a4dbff9456cef4500a2e9e100e0d87a060f (diff) | |
| download | vimium-55d13097c9ff8f6301a4bf64b42740ae5edcf71c.tar.bz2 | |
Shorten the declaration of async completer.
| -rw-r--r-- | background_page.html | 2 | ||||
| -rw-r--r-- | lib/completion.js | 21 |
2 files changed, 12 insertions, 11 deletions
diff --git a/background_page.html b/background_page.html index d9873d87..0a120997 100644 --- a/background_page.html +++ b/background_page.html @@ -1,8 +1,8 @@ <html> <head> +<script type="text/javascript" src="lib/utils.js"></script> <script type="text/javascript" src="commands.js"></script> <script type="text/javascript" src="lib/clipboard.js"></script> -<script type="text/javascript" src="lib/utils.js"></script> <script type="text/javascript" src="background/settings.js"></script> <script type="text/javascript" src="lib/completion.js"></script> <script type="text/javascript" charset="utf-8"> 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. */ |
