From 55d13097c9ff8f6301a4bf64b42740ae5edcf71c Mon Sep 17 00:00:00 2001 From: Phil Crosby Date: Mon, 30 Apr 2012 00:00:33 -0700 Subject: Shorten the declaration of async completer. --- lib/completion.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'lib/completion.js') diff --git a/lib/completion.js b/lib/completion.js index e8365b9c..7e4bcf57 100644 --- a/lib/completion.js +++ b/lib/completion.js @@ -2,14 +2,15 @@ var completion = (function() { /** Helper class to construct fuzzy completers for asynchronous data sources like history or bookmark * matchers. */ - var AsyncCompletionSource = function() { - this.id = utils.createUniqueId(); - this.reset(); - this.resultsReady = this.fallbackReadyCallback = function(results) { - this.completions = results; - } - } - AsyncCompletionSource.prototype = { + var AsyncCompletionSource = Class.extend({ + init: function() { + this.id = utils.createUniqueId(); + this.reset(); + this.resultsReady = this.fallbackReadyCallback = function(results) { + this.completions = results; + } + }, + reset: function() { fuzzyMatcher.invalidateFilterCache(this.id); this.completions = null; @@ -64,8 +65,8 @@ var completion = (function() { self.resultsReady(results); } } - }, - } + } + }); /** A simple completer that suggests to open the input string as an URL or to trigger a web search for the * given term, depending on whether it thinks the input is a URL or not. */ -- cgit v1.2.3