[英]Automatically send SCORM data to LMS
到目前為止,我已經有了這段代碼...
function sendData() {
// this work out where I am and construct the 'cmi.core.lesson.location' variable
computeTime();
var a = "" + (course.length - 1) + "|";
for (i = 1; i < course.length; i++) {
a = a + qbin2hex(course[i].pages).join("") + "|";
if (iLP == 1) {
a = a + course[i].duration + "|";
a = a + course[i].timecompleted + "|"
}
}
SetQuizDetails();
a = a + course[0].quiz_score_running + "|0|0|0|0|0|0|";
objAPI.LMSSetValue("cmi.core.lesson_location", "LP_AT7|" + a);
bFinishDone = (objAPI.LMSCommit("") == "true");
objAPI.LMSCommit("");
console.log("Data Sent!");
}
setTimeout(sendData(), 1000);
但是,它似乎沒有達到預期的目的。 數據應該每1000毫秒發送到服務器,但這沒有發生。 我在這里想念什么?
我要指出的是,這是SCORM 1.2。
所以,你在打電話
setTimeout(sendData(), 1000);
相當於
var foo = sendData();
setTimeout(foo, 1000);
看到sendData
返回任何內容,這等效於
setTimeout(undefined, 1000);
您可能的意思是:
setTimeout(sendData, 1000);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.