diff options
| author | Phil Crosby | 2012-06-17 00:15:12 -0700 | 
|---|---|---|
| committer | Phil Crosby | 2012-06-17 00:15:24 -0700 | 
| commit | 5de493d0740835e0d7dbd0e90bcc679df835547f (patch) | |
| tree | 246e5f622ede9b68ba0470be54f7e24a4213f7cc | |
| parent | c7a4dbbda25c732844543397e4552570ecc0332d (diff) | |
| download | vimium-5de493d0740835e0d7dbd0e90bcc679df835547f.tar.bz2 | |
Use the browser's built-in bind() instead of our proxy()
| -rw-r--r-- | background_scripts/completion.coffee | 4 | ||||
| -rw-r--r-- | lib/utils.coffee | 5 | 
2 files changed, 2 insertions, 7 deletions
| diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index 5d0f939a..b9069dce 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -174,7 +174,7 @@ class DomainCompleter          if domain            previousEntry = @domains[domain]            @domains[domain] = entry if !previousEntry || (previousEntry.lastVisitTime < entry.lastVisitTime) -      chrome.history.onVisited.addListener(@onPageVisited.proxy(this)) +      chrome.history.onVisited.addListener(@onPageVisited.bind(this))        onComplete()    onPageVisited: (newPage) -> @@ -320,7 +320,7 @@ HistoryCache =      chrome.history.search { text: "", maxResults: @size, startTime: 0 }, (history) =>        history.sort @compareHistoryByUrl        @history = history -      chrome.history.onVisited.addListener(@onPageVisited.proxy(this)) +      chrome.history.onVisited.addListener(@onPageVisited.bind(this))        callback(@history) for callback in @callbacks        @callbacks = null diff --git a/lib/utils.coffee b/lib/utils.coffee index c83a6cf8..6a846ae0 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -103,11 +103,6 @@ Utils =      string = string.trim()      if (Utils.isUrl(string)) then Utils.createFullUrl(string) else Utils.createSearchUrl(string) -# Execute a function with the given value for "this". Equivalent to jQuery.proxy(). */ -Function.prototype.proxy = (self) -> -  fn = this -  return -> fn.apply(self, arguments) -  # This creates a new function out of an existing function, where the new function takes fewer arguments.  # This allows us to pass around functions instead of functions + a partial list of arguments.  Function.prototype.curry = -> | 
