A
Andrew Poulos
I'm building some code that using this type of structure to interface to
SCORM compliant LMS:
var API = (function() {
// Private variables
var started = false;
// Private methods
// Public methods
return {
// Initialise
Initialize : function() {
started = true;
}
}
})();
Unfortunately there are two common standards that need to be satisfied
and I was hoping to do it with minimal duplication.
My problems are these:
1. Some LMS will be referring to 'API' and some will be expecting the
name 'API_1484_11'. If I add this line
var API_1484_11 = API;
does that mean, say, that I could call API.Initialize() and it would be
the same as calling API_1484_11.Initialize()?
2. The public methods are identical in content but need to have slightly
different names for 'API' and 'API_1484_11'. For example, 'Initialize'
and 'LMSInitialize'. How can I achieve this without duplicating the
entire method?
Andrew Poulos
SCORM compliant LMS:
var API = (function() {
// Private variables
var started = false;
// Private methods
// Public methods
return {
// Initialise
Initialize : function() {
started = true;
}
}
})();
Unfortunately there are two common standards that need to be satisfied
and I was hoping to do it with minimal duplication.
My problems are these:
1. Some LMS will be referring to 'API' and some will be expecting the
name 'API_1484_11'. If I add this line
var API_1484_11 = API;
does that mean, say, that I could call API.Initialize() and it would be
the same as calling API_1484_11.Initialize()?
2. The public methods are identical in content but need to have slightly
different names for 'API' and 'API_1484_11'. For example, 'Initialize'
and 'LMSInitialize'. How can I achieve this without duplicating the
entire method?
Andrew Poulos