Skip to content

Instantly share code, notes, and snippets.

@JayV30
Created January 24, 2020 13:04
Show Gist options
  • Save JayV30/7b09eb50963503b4ac18ec5baa251848 to your computer and use it in GitHub Desktop.
Save JayV30/7b09eb50963503b4ac18ec5baa251848 to your computer and use it in GitHub Desktop.
Mock SCORM API for testing and development
<script>
// fake SCORM API as this is not SCORM-packaged
window.API = (function(){
var data = {
"cmi.core.student_id": "000100",
"cmi.core.student_name": "Student, Joe",
"cmi.core.lesson_location": "",
"cmi.core.lesson_status": "not attempted",
"cmi.suspend_data": ""
};
return {
LMSInitialize: function() {
return "true";
},
LMSCommit: function() {
return "true";
},
LMSFinish: function() {
return "true";
},
LMSGetValue: function(model) {
return data[model] || "";
},
LMSSetValue: function(model, value) {
data[model] = value;
return "true";
},
LMSGetLastError: function() {
return "0";
},
LMSGetErrorString: function(errorCode) {
return "No error";
},
LMSGetDiagnostic: function(errorCode) {
return "No error";
}
};
})();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment