aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/completion.coffee8
1 files changed, 5 insertions, 3 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee
index f76b0fe9..040b1fdb 100644
--- a/background_scripts/completion.coffee
+++ b/background_scripts/completion.coffee
@@ -257,12 +257,14 @@ HistoryCache =
# sorting in ascending order. We will push new items on to the end as the user navigates to new pages.
history.sort((a, b) -> (a.lastVisitTime || 0) - (b.lastVisitTime || 0))
@history = history
- chrome.history.onVisited.addListener (newSite) =>
- firstTimeVisit = (newSite.visitedCount == 1)
- @history.push(newSite) if firstTimeVisit
+ chrome.history.onVisited.addListener(@onPageVisited.proxy(this))
callback(@history) for callback in @callbacks
@callbacks = null
+ onPageVisited: (newPage) ->
+ firstTimeVisit = (newSite.visitedCount == 1)
+ @history.push(newSite) if firstTimeVisit
+
root = exports ? window
root.Suggestion = Suggestion
root.BookmarkCompleter = BookmarkCompleter