| 68 | // method can be called like a regular function, it has the target permanently |
| 69 | // bound to it so "this" will work correctly. |
| 70 | function overrideMethod(target, methodName, funcSource) { |
| 71 | var superFunc = target[methodName] || function() {}; |
| 72 | var superFuncBound = function() { |
| 73 | return superFunc.apply(target, arguments); |
| 74 | }; |
| 75 | target[methodName] = funcSource(superFuncBound); |
| 76 | } |
| 77 | |
| 78 | // Add a method to delegator that, when invoked, calls |
| 79 | // delegatee.methodName. If there is no such method on |