mgm
Version:
My generic modules
12 lines • 483 B
JavaScript
const InvocationHandler = require('./InvocationHandler');
module.exports = class InvocationHandlerMethod extends InvocationHandler {
constructor(object) {
super();
this.object = object;
Object.getOwnPropertyNames(Object.getPrototypeOf(object)).filter(methodName => {
return methodName !== "constructor"
}).forEach(methodName => {
this[methodName] = this.invoke.bind(this, object[methodName]);
});
}
}