Andrew Poulos wrote:
>I have this (the name is fixed by the LMS):
The London, Midland and Scottish railway company ceased trading in the
middle of the last century. It is unlikely that they could have dictated
anything relating to browser scripting.
The FAQ advises that acronyms (and particularly TLAs) should not be
posted without explanation unless they are truly unambiguous (and very
few are).
var API_1484_11 = (function() {
// private variables
// private methods
// public methods
return {
get : function() {
if (called via API) {
} else {
}
}
};
})();
and because an older LMS expect a different name I have this
var API = API_1484_11;
The code is effectively identical for both but API has a few subtle
differences that I need to take into account.
Is there a someway to tell if the public methods are called
via API or API_1484_11?
Not at all easily if they are the same object, and certainly not
reliably, efficiently or in a cross-browser manner. The only information
on the subject would be the source code that made the call, and although
in most cases (but certainly not all) - arguments.calleee.toString -
might expose that source code the work needed to extract the information
would be a huge (and pointless) overhead.
It would probably be simpler to wrap the fist object in a second that
implemented an identical public interface and then you could know which
was called based on the identity of the functions that made up the two
interfaces.
If the "code is effectively identical" there is no sense in asking this
question, or implementing any answer you may find.
Richard.