diff options
| author | Stephen Blott | 2015-06-06 06:53:56 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2015-06-06 06:54:17 +0100 | 
| commit | 2d5a01c9791a81aa87eaa935a1183f10950bdc84 (patch) | |
| tree | 148b6a071a3f19476d21875ef63d9b84baf7b69c | |
| parent | f5db9ea1dc8d23dff732dd3345bf85798d64f1e9 (diff) | |
| download | vimium-2d5a01c9791a81aa87eaa935a1183f10950bdc84.tar.bz2 | |
Re-work completions: add engine wrapper.
| -rw-r--r-- | background_scripts/completion_search.coffee | 11 | 
1 files changed, 10 insertions, 1 deletions
| diff --git a/background_scripts/completion_search.coffee b/background_scripts/completion_search.coffee index cb819025..b3ae88d4 100644 --- a/background_scripts/completion_search.coffee +++ b/background_scripts/completion_search.coffee @@ -1,4 +1,13 @@ +class EngineWrapper +  constructor: (@searchUrl, @engine) -> + +  getUrl: (queryTerms) -> +    @engine.getUrl queryTerms + +  parse: (xhr) -> +    @engine.parse xhr +  CompletionSearch =    debug: false    inTransit: {} @@ -93,7 +102,7 @@ CompletionSearch =          # Elide duplicate requests. First fetch the suggestions...          @inTransit[completionCacheKey] ?= new AsyncDataFetcher (callback) => -          engine = @lookupEngine searchUrl +          engine = new EngineWrapper searchUrl, @lookupEngine searchUrl            url = engine.getUrl queryTerms            @get searchUrl, url, (xhr = null) => | 
