gpt4 book ai didi

javascript - 自动将SCORM数据发送到LMS

转载 作者:行者123 更新时间:2023-11-28 01:11:12 25 4
gpt4 key购买 nike

到目前为止我有这个代码...

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);

关于javascript - 自动将SCORM数据发送到LMS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24406553/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com