diff options
| author | Phil Crosby | 2012-04-30 00:00:08 -0700 |
|---|---|---|
| committer | Phil Crosby | 2012-04-30 00:13:07 -0700 |
| commit | 31a88a4dbff9456cef4500a2e9e100e0d87a060f (patch) | |
| tree | a07008b8355ddefa0d31ec101d39a00ecd1103ec /lib/utils.js | |
| parent | ff3d71cb6fa243d1e3b3a8d1c6b659f0e563fb39 (diff) | |
| download | vimium-31a88a4dbff9456cef4500a2e9e100e0d87a060f.tar.bz2 | |
Add Function.proxy.
Diffstat (limited to 'lib/utils.js')
| -rw-r--r-- | lib/utils.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/utils.js b/lib/utils.js index ca7ce2bc..3a355d7b 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -156,10 +156,13 @@ var utils = { return utils.createFullUrl(str); else return utils.createSearchUrl(str); - }, - + } }; +/* Execute a function with the given value for "this". Equivalent to jQuery.proxy(). */ +Function.prototype.proxy = function(fn, self) { return function() { fn.apply(self, arguments); }; }; + + /* * Simple JavaScript Inheritance, by John Resig. * This provides a short syntax for organizing code into classes. |
