I have a code like the one bellow and want to detect the instance name of my exScript.
In this case it would be exScript123.
eecore = {
something: 1,
// ...
someelse: function() { /* whatever */ };
};
var exScript = (function (undefined) {
function exScript(inputOptions) {
this.version = "0.0";
}
exScript.prototype.init = function () {
// some code here
};
return exScript;
})();
eecore.exScript123 = new exScript();
eecore.exScript123.init();
I have been experimenting for the last hour with arguments.calle.name and this.parent.name but they do not seem to work in my case. I keep getting undefined.
exScript123. I need to getexScript123inside of the init prototype. In order to set a cookie that holds some data uniquely for this instance so it does not conflict with others.eecore.exScript123 = eecore.foo = eecore.bar = new exScript()? ShouldexScript123,fooorbarbe returned (as they all point to the same object)? (That's actually a rhetorical question, what you want to achieve is not possible in the first place.)nameargument on the constructor so the instance has its own record of it?