I use a small home structure to easily use prototype inheritance, and in this structure I have the same code. I think there is no way to do without this.
Now the question is: why not do it? Do you think this is bad practice and why?
The piece of code that I use:
function getCallback(obj, methodName) { var method = obj[methodName]; function callback() { if (obj[methodName] === callback) { return method.apply(obj, arguments); } return obj[methodName].apply(obj, arguments); } return callback; }
source share