API Hook

Jan 10, 2014

I don't fully understand how the API is "found" within the SCORM2004 specification.

The code for the function is as follows, as published by Articulate Storyline:

function SCORM2004_SearchForAPI(wndLookIn){

WriteToDebug("SCORM2004_SearchForAPI");
var objAPITemp = null;
var strDebugID = "";
strDebugID = "Name=" + wndLookIn.name + ", href=" + wndLookIn.location.href
objAPITemp = wndLookIn.API_1484_11;
if (SCORM2004_APIFound(objAPITemp)){
WriteToDebug("Found API in this window - "  + strDebugID);
return objAPITemp;
}
if (SCORM2004_WindowHasParent(wndLookIn)){
WriteToDebug("Searching Parent - "  + strDebugID);
objAPITemp = SCORM2004_SearchForAPI(wndLookIn.parent);
}
if (SCORM2004_APIFound(objAPITemp)){
WriteToDebug("Found API in a parent - "  + strDebugID);
return objAPITemp;
}
if (SCORM2004_WindowHasOpener(wndLookIn)){
WriteToDebug("Searching Opener - "  + strDebugID);
objAPITemp = SCORM2004_SearchForAPI(wndLookIn.opener);
}
if (SCORM2004_APIFound(objAPITemp)){
WriteToDebug("Found API in an opener - "  + strDebugID);
return objAPITemp;
}
//look in child frames individually, don't call this function recursively
//on them to prevent an infinite loop when it looks back up to the parents
WriteToDebug("Looking in children - "  + strDebugID);
objAPITemp = SCORM2004_LookInChildren(wndLookIn);
if (SCORM2004_APIFound(objAPITemp)){
WriteToDebug("Found API in Children - "  + strDebugID);
return objAPITemp;
}
WriteToDebug("Didn't find API in this window - "  + strDebugID);
return null;
}
What does it mean for the window to look into itself for an API? How exactly do I link the browser window to an API?
Sorry, I'm a bit of an Articulate AND JS newbie, so I'm not entirely sure how it all comes together.
Thanks in advance!
Be the first to reply

This discussion is closed. You can start a new discussion or contact Articulate Support.