From 7d11b1699454366bf99e8e5033ba39b127687fcb Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Wed, 6 May 2015 04:55:22 +0100 Subject: Search completion; simplify messaging code. This eliminates the need to repeatedly install and remove listeners for @filterPort in the vomnibar. It also eleiminates the need for "keepAlive" in reponses. All as suggested by @mrmr1993 in #1635. --- background_scripts/completion.coffee | 4 ++-- background_scripts/main.coffee | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'background_scripts') diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index 729e86ab..c91825b5 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -478,12 +478,12 @@ class MultiCompleter # (ie. a SearchEngineCompleter). This prevents hiding the vomnibar briefly before showing it # again, which looks ugly. unless shouldRunContinuation and suggestions.length == 0 - onComplete @prepareSuggestions(queryTerms, suggestions), keepAlive: shouldRunContinuation + onComplete @prepareSuggestions queryTerms, suggestions # Allow subsequent queries to begin. @filterInProgress = false if shouldRunContinuation continuation suggestions, (newSuggestions) => - onComplete @prepareSuggestions queryTerms, suggestions.concat(newSuggestions) + onComplete @prepareSuggestions queryTerms, suggestions.concat newSuggestions else @filter @mostRecentQuery.queryTerms, @mostRecentQuery.onComplete if @mostRecentQuery diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 44644769..09a6b89f 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -226,8 +226,8 @@ filterCompleter = (args, port) -> if args.id? and args.name? and args.query? queryTerms = if (args.query == "") then [] else args.query.split(whitespaceRegexp) - completers[args.name].filter queryTerms, (results, extra = {}) -> - port.postMessage extend extra, id: args.id, results: results + completers[args.name].filter queryTerms, (results) -> + port.postMessage id: args.id, results: results chrome.tabs.onSelectionChanged.addListener (tabId, selectionInfo) -> if (selectionChangedHandlers.length > 0) -- cgit v1.2.3