aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/completion.js18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/completion.js b/lib/completion.js
index fefa92fa..a00f2dab 100644
--- a/lib/completion.js
+++ b/lib/completion.js
@@ -6,9 +6,7 @@ var completion = (function() {
init: function() {
this.id = utils.createUniqueId();
this.reset();
- this.resultsReady = this.fallbackReadyCallback = function(results) {
- this.completions = results;
- }
+ this.resultsReady = this.fallbackReadyCallback = function(results) { this.completions = results; }
},
reset: function() {
@@ -116,7 +114,10 @@ var completion = (function() {
});
/** A fuzzy bookmark completer */
- var FuzzyBookmarkCompletionSource = AsyncCompletionSource.extend({
+ var FuzzyBookmarkCompletionSource = Class.extend({
+ init: function() { this.asyncCompleter = new AsyncCompletionSource(); },
+ filter: function(query, callback) { return this.asyncCompleter.filter(query, callback); },
+
// Traverses the bookmark hierarhcy and retuns a list of all bookmarks in the tree.
traverseBookmarkTree: function(bookmarks) {
var results = [];
@@ -131,13 +132,14 @@ var completion = (function() {
},
refresh: function() {
- this.reset();
+ this.asyncCompleter.reset();
chrome.bookmarks.getTree(function(bookmarks) {
var results = this.traverseBookmarkTree(bookmarks);
var validResults = results.filter(function(b) { return b.url !== undefined; });
- var matches = validResults.map(
- function(bookmark) { return this.createInternalMatch("bookmark", bookmark); }.proxy(this));
- this.resultsReady(matches);
+ var matches = validResults.map(function(bookmark) {
+ return this.asyncCompleter.createInternalMatch("bookmark", bookmark);
+ }.proxy(this));
+ this.asyncCompleter.resultsReady(matches);
}.proxy(this));
}
});