diff options
| author | Stephen Blott | 2015-05-03 17:22:20 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-05-03 17:22:20 +0100 |
| commit | 776f617ece5d333fe70df903982a18d65fc2776a (patch) | |
| tree | 8d4fd8e22d128629df9a1998fc1f716c08b6791e /background_scripts/main.coffee | |
| parent | 7d59e948da154203722b442c477b452f7a393161 (diff) | |
| download | vimium-776f617ece5d333fe70df903982a18d65fc2776a.tar.bz2 | |
Search completion; make completion lookup asynchronous.
Diffstat (limited to 'background_scripts/main.coffee')
| -rw-r--r-- | background_scripts/main.coffee | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 4d2546fc..45619023 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -50,11 +50,13 @@ completionSources = searchEngines: new SearchEngineCompleter() completers = - omni: new MultiCompleter([ - completionSources.searchEngines, - completionSources.bookmarks, - completionSources.history, - completionSources.domains]) + omni: new MultiCompleter [ + completionSources.bookmarks + completionSources.history + completionSources.domains + # This comes last, because it delivers additional, asynchronous results. + completionSources.searchEngines + ] bookmarks: new MultiCompleter([completionSources.bookmarks]) tabs: new MultiCompleter([completionSources.tabs]) @@ -220,7 +222,8 @@ refreshCompleter = (request) -> completers[request.name].refresh() whitespaceRegexp = /\s+/ filterCompleter = (args, port) -> queryTerms = if (args.query == "") then [] else args.query.split(whitespaceRegexp) - completers[args.name].filter(queryTerms, (results) -> port.postMessage({ id: args.id, results: results })) + completers[args.name].filter queryTerms, (results, extra = {}) -> + port.postMessage extend extra, id: args.id, results: results chrome.tabs.onSelectionChanged.addListener (tabId, selectionInfo) -> if (selectionChangedHandlers.length > 0) |
