I am looking for a way to determine the name of the class of an object from within a function that called that function. My approach involves utilizing John Resig's class inheritance concept.
For instance
var CoreStuff = Class.extend({ log: function(Message) { console.log(who + ' said ' + Message); });
var MyApp = CoreStuff.extend({ init: function() { this.log('Hello world!'); });
var app = new MyApp();
How can I identify whether MyApp
or CoreStuff
or any other object triggered log()
within the hierarchy?
I prefer not to include additional parameters with the current class as I am currently doing.