diff options
| author | Phil Crosby | 2012-05-05 00:07:38 -0700 | 
|---|---|---|
| committer | Phil Crosby | 2012-05-05 18:32:13 -0700 | 
| commit | 9f3cfbe69d591d5aea9fc3aef34fc7f1d25eddbf (patch) | |
| tree | 931d7bfbe85eca34054bf800d497be319332b6b1 /lib/completion.js | |
| parent | 9f026c45189766f74231b6abcc022a81aca964be (diff) | |
| download | vimium-9f3cfbe69d591d5aea9fc3aef34fc7f1d25eddbf.tar.bz2 | |
Favor composition over inheritence
Diffstat (limited to 'lib/completion.js')
| -rw-r--r-- | lib/completion.js | 12 | 
1 files changed, 7 insertions, 5 deletions
| diff --git a/lib/completion.js b/lib/completion.js index a00f2dab..bc9b6fc6 100644 --- a/lib/completion.js +++ b/lib/completion.js @@ -145,18 +145,20 @@ var completion = (function() {    });    /** A fuzzy history completer */ -  var FuzzyHistoryCompletionSource = AsyncCompletionSource.extend({ +  var FuzzyHistoryCompletionSource = Class.extend({      init: function(maxResults) { -      this._super(); +      this.asyncCompleter = new AsyncCompletionSource();        this.maxResults = maxResults;      }, +    filter: function(query, callback) { return this.asyncCompleter.filter(query, callback); }, +      refresh: function() { -      this.reset(); +      this.asyncCompleter.reset();        historyCache.use(function(history) { -        this.resultsReady(history.slice(-this.maxResults).map(function(item) { -          return this.createInternalMatch("history", item); +        this.asyncCompleter.resultsReady(history.slice(-this.maxResults).map(function(item) { +          return this.asyncCompleter.createInternalMatch("history", item);          }.proxy(this)));        }.proxy(this));      } | 
