Created
September 9, 2016 09:23
-
-
Save cajones/66b665cdd06c2c1452a78d4a616529b5 to your computer and use it in GitHub Desktop.
Locating the SCORM API from a module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function locateScormAPI() { | |
function findAPI(win) { | |
var attempts = 0; | |
while (win.API == null && win.parent != null && win.parent != win) { | |
if (++attempts > 7) return null; | |
win = win.parent; | |
} | |
return win.API; | |
} | |
return findAPI(window) || findAPI(window.opener); | |
} | |
var lmsAPI = locateScormAPI(); | |
// lmsAPI.SetValue('cmi.core.lessonStatus', 'passed'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment