cybercussion / SCOBot

SCORM API for Content. JavaScript library, QUnit tests and examples.
https://cybercussion.com
156 stars 34 forks source link

Suspend data is null after refreshing the page when the course is launched very first time. #11

Closed haseeb200 closed 4 years ago

haseeb200 commented 4 years ago

I am using the scobot js for initializing and launching scorm based course. I am having the following issue when I try to get suspended data.

when the course is launched very first time the suspended data is null and as soon as the course started I save the suspended data using js and it is successfully saved. The issue occurs when I don't close the course window and just refresh it with CTRL+F5. Then I get suspended data null in the following method

SCOBotUtil.addEvent(SB, 'load', function (e) {         // in 4.x.x
    // SCOBot already took care of connection to the LMS and Initialize!
    // Do everything else you would do to fire up or resume your content here.
    var suspendData = getLMSValue("cmi.suspend_data");

    console.log(`From Scobot Js = ${suspendData}`);
    return false;
});

But when I again refresh the page using CTRL+F5 it works fine. Also, after launching the course very first time and then I close the window and start the course again it works fine.

my question is why I am getting suspended data null after launching course very first time and then do a hard refresh without closing the course window? It should give me suspended data

haseeb200 commented 4 years ago

The issue is resolved. I was not calling the commit method using scobot.