diff options
| author | Stephen Blott | 2015-05-10 05:57:47 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-05-10 06:12:39 +0100 |
| commit | 5fdbb8e579c068a54e9a397097d87063a3d8a146 (patch) | |
| tree | 7167ff7a914724b7b6532162db84e24b03aabea2 /background_scripts | |
| parent | 313a1f96d666f23c2bc75ef340f0f828319e127c (diff) | |
| download | vimium-5fdbb8e579c068a54e9a397097d87063a3d8a146.tar.bz2 | |
Search completion; rework SimpleCache.
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/completion.coffee | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index 94109b84..024ea54c 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -355,11 +355,14 @@ class TabCompleter tabRecency.recencyScore(suggestion.tabId) class SearchEngineCompleter - searchEngineConfig: null + searchEngines: null + + cancel: -> + CompletionEngines.cancel() refresh: (port) -> # Load and parse the search-engine configuration. - @searchEngineConfig = new AsyncDataFetcher (callback) -> + @searchEngines = new AsyncDataFetcher (callback) -> engines = {} for line in Settings.get("searchEngines").split "\n" line = line.trim() @@ -373,18 +376,18 @@ class SearchEngineCompleter searchUrl: tokens[1] description: description - # Deliver the resulting engines lookup table. + # Deliver the resulting engines AsyncDataFetcher lookup table. callback engines # Let the vomnibar know the custom search engine keywords. port.postMessage - handler: "customSearchEngineKeywords" + handler: "keywords" keywords: key for own key of engines filter: ({ queryTerms, query }, onComplete) -> return onComplete [] if queryTerms.length == 0 - @searchEngineConfig.use (engines) => + @searchEngines.use (engines) => keyword = queryTerms[0] { custom, searchUrl, description, queryTerms } = @@ -482,9 +485,6 @@ class SearchEngineCompleter count = Math.min 6, Math.max 3, MultiCompleter.maxResults - existingSuggestions.length onComplete suggestions[...count] - cancel: -> - CompletionEngines.cancel() - # A completer which calls filter() on many completers, aggregates the results, ranks them, and returns the top # 10. Queries from the vomnibar frontend script come through a multi completer. class MultiCompleter |
