aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPhil Crosby2012-05-05 00:11:57 -0700
committerPhil Crosby2012-05-05 18:32:13 -0700
commit63e66ffd7def88563ab3f705fe91eea85118cb85 (patch)
treece9fb09d0ea6caee11a66f0ca2f3c6c665cf03c0 /lib
parent3a0f19dc531c2a5fafc02f1e4f97cab5517c93bf (diff)
downloadvimium-63e66ffd7def88563ab3f705fe91eea85118cb85.tar.bz2
shorten the definition of BackgroundCompleter
Diffstat (limited to 'lib')
-rw-r--r--lib/completion.js22
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