JSFiddle - React, Tailwind, and code Playground
JavaScript
function SomeClass () {
this.someFunction = function() {
alert("done");
};
this.someFunction = (function() {
var cached_function = someFunction;
return function() {
alert("new code");
cached_function.apply(this, arguments); // use .apply() to call it
};
}());
}
someInstance = new SomeClass();
someIntance.someFunction();