diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/completion.js | 22 | 
1 files changed, 9 insertions, 13 deletions
| diff --git a/lib/completion.js b/lib/completion.js index 240468cb..fa2e9209 100644 --- a/lib/completion.js +++ b/lib/completion.js @@ -254,15 +254,14 @@ var completion = (function() {    });    /** Get completion results from the background page */ -  var BackgroundCompleter = function(name) { -    this.name = name; -    this.filterPort = chrome.extension.connect({ name: 'filterCompleter' }); -  } -  BackgroundCompleter.prototype = { -    refresh: function() { -      chrome.extension.sendRequest({ handler: 'refreshCompleter', name: this.name }); +  var BackgroundCompleter = Class.extend({ +    init: function(name) { +      this.name = name; +      this.filterPort = chrome.extension.connect({ name: "filterCompleter" });      }, +    refresh: function() { chrome.extension.sendRequest({ handler: "refreshCompleter", name: this.name }); }, +      filter: function(query, maxResults, callback) {        var id = utils.createUniqueId();        this.filterPort.onMessage.addListener(function(msg) { @@ -273,12 +272,9 @@ var completion = (function() {            return result;          }));        }); -      this.filterPort.postMessage({ id: id, -                                    name: this.name, -                                    query: query, -                                    maxResults: maxResults }); -    }, -  } +      this.filterPort.postMessage({ id: id, name: this.name, query: query, maxResults: maxResults }); +    } +  });    /** A meta-completer that delegates queries and merges and sorts the results of a collection of other     * completer instances given in :sources. The optional argument :queryThreshold determines how long a | 
