JSFiddle - React, Tailwind, and code Playground
by Shamasis Bhattacharya
JavaScript
(function (ns) {
var uid = (function () {
id = 0;
return function () {
return id++;
};
}());
ns.chatterbox = function (obj, name) {
name = name || 'function-' + uid();
for (var item in obj) {
if (typeof obj[item] === 'function') {
obj[item] = (function (fn, item) {
return function () {
console.log(name + '.' + item, arguments);
return fn.apply(this, arguments);
};
}(obj[item], item));
}
}
};
}(window));
var Test = function () {
};
Test.prototype.onefunction = function () {};
chatterbox(Test.prototype, 'Test');
var myTest = new Test();
myTest.onefunction();