Search code examples
javascriptapiscormscorm1.2

SCORM 1.0 / 1.2 LMSFinish not calling


I've been running in to some trouble with HTML5 SCORM packages.

TL;DR; LMSFinish() isn't being called. x.prototype.terminate() within SCORM is also not being called which leads me to believe a problem with the package.

LMSFinish() is supposed to be called upon exit button click (and / or on window close). However console.log() and breakpoints within LMSFinish() reveal that this is not being called.

LMSInitialise is fine when the window opens, but for LMSFinish after inspecting the source inside SCORM and placing breakpoints within the window.unload() function I can see it only gets part of the way to exiting.

window.unload calls closeLms(), which in turn runs obfuscated x.prototype.terminate(). This terminate function appears to do a boolean check before calling some other functions which eventually leads to calling LMSFinish(). It never gets that far. The boolean check in x.prototype.terminate() is always false. If I set it to true in the console, some other properties don't exist and the resulting function call fails with an error.

Does any one have any idea why SCORM would fail to run LMSFinish()? The test SCORM package is simply 3 slides with no interaction.

EDIT: The only custom javascript written are the hooks for the SCORM API (LMSInitialise, LMSFinish e.t.c) These are called from the javascript within the SCORM package, as generated by whatever application the user decides to use to create it. (Articulate, Captivate e.t.c)


Solution

  • I figured this out in end. For anybody who might be having issues with SCORM not behaving as expected.

    In my particular case LMSSetValue() and LMSGetValue() were only returning the things that were needed in the project. It turns out they both need to handle every value that SCORM tries to Set and Get regardless of if you use it or not.

    I simple created an object as a property of window.API{} and made sure it was assigned all the values on LMSSetValue() in key value pairs, and those values were then ready for retrieval at LMSGetValue().