blob: 0c992ad40af5e7a38f7898f74442e69b32b176fd (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
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);
  },
};
 |