jcputney / scorm-again

A modern SCORM JavaScript runtime library.
https://jcputney.github.io/scorm-again/
MIT License
217 stars 53 forks source link

How to handle a Multi-SCORM course #676

Open mikexmagic opened 1 year ago

mikexmagic commented 1 year ago

How do I switch between sections in SCORM courses with multiple SCO items? Each of these items starts with a different homepage, which is defined in the resource tags of the XML. You can refer to the multi-SCO example on https://scorm.com/scorm-explained/technical-scorm/golf-examples/. Each section looks for the API and wants to initialize it. How do I switch between individual sections? How do I reset an already initialized API?

medelmourabite commented 1 year ago

Hi, I managed to do this using pages

 const [pageIndex, setPageIndex] = useState(0);
 const course =  {
      id: '49f5fcef7b13261e68b39ed04',
      title: 'Test Course',
      entryPoint: 'index.html',
      pages: ['index.html', 'page1.html'],
      scormVersion: '2004 4th Edition',
    }
  const courseUrl = course
    ? '/packages/' + course.id + '/' + (course.pages?.[pageIndex] || course.entryPoint)
    : '';

hope this help

github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

jcputney commented 2 weeks ago

@mikexmagic I actually haven't worked with multi-module packages before, so I'll have to do some testing and see if I can come up with a recommendation. @medelmourabite glad you were able to find a working solution.

jcputney commented 2 weeks ago

@mikexmagic I have added in a way to reset the API back to its initial state. It will be in the 2.1.0 release, which should be out soon.