aboutsummaryrefslogtreecommitdiffstats
path: root/lib/utils.js
diff options
context:
space:
mode:
authorjez2011-05-14 20:34:29 -0400
committerjez2011-05-14 20:34:29 -0400
commitd6e059f2a3b8db7695de3851d48e62a6ca925af9 (patch)
tree57a01d033f78f8b323e4503d33bbddbd833cd973 /lib/utils.js
parent9fa550086afb0e3bb944721f0422f60ec50b69b7 (diff)
parent1cdbf5b3ceb6a35044eff1ffbfd54ac6e63bc84a (diff)
downloadvimium-d6e059f2a3b8db7695de3851d48e62a6ca925af9.tar.bz2
Merge branch 'bookmarks'
Conflicts: commands.js linkHints.js vimiumFrontend.js
Diffstat (limited to 'lib/utils.js')
-rw-r--r--lib/utils.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/utils.js b/lib/utils.js
new file mode 100644
index 00000000..0c992ad4
--- /dev/null
+++ b/lib/utils.js
@@ -0,0 +1,14 @@
+var utils = {
+ /*
+ * Takes a dot-notation object string and call the function
+ * that it points to with the correct value for 'this'.
+ */
+ invokeCommandString: function(str, argArray) {
+ var components = str.split('.');
+ var obj = window;
+ for (var i = 0; i < components.length - 1; i++)
+ obj = obj[components[i]];
+ var func = obj[components.pop()];
+ return func.apply(obj, argArray);
+ },
+};