aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPhil Crosby2012-05-05 00:07:38 -0700
committerPhil Crosby2012-05-05 18:32:13 -0700
commit9f3cfbe69d591d5aea9fc3aef34fc7f1d25eddbf (patch)
tree931d7bfbe85eca34054bf800d497be319332b6b1 /lib
parent9f026c45189766f74231b6abcc022a81aca964be (diff)
downloadvimium-9f3cfbe69d591d5aea9fc3aef34fc7f1d25eddbf.tar.bz2
Favor composition over inheritence
Diffstat (limited to 'lib')
-rw-r--r--lib/completion.js12
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));
}