aboutsummaryrefslogtreecommitdiffstats
path: root/lib/utils.js
diff options
context:
space:
mode:
authorPhil Crosby2012-04-30 00:00:08 -0700
committerPhil Crosby2012-04-30 00:13:07 -0700
commit31a88a4dbff9456cef4500a2e9e100e0d87a060f (patch)
treea07008b8355ddefa0d31ec101d39a00ecd1103ec /lib/utils.js
parentff3d71cb6fa243d1e3b3a8d1c6b659f0e563fb39 (diff)
downloadvimium-31a88a4dbff9456cef4500a2e9e100e0d87a060f.tar.bz2
Add Function.proxy.
Diffstat (limited to 'lib/utils.js')
-rw-r--r--lib/utils.js7
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.