pipwerks / scorm-api-wrapper

The pipwerks SCORM API Wrapper
http://pipwerks.com
362 stars 125 forks source link

SCORM.API.find: Error finding API. #51

Closed ayubkidvento closed 1 month ago

ayubkidvento commented 1 month ago

Hello, I've got a scorm(scorm 1.2) that needs to be integrated with React app. I'm using pipwerks-scorm-api-wrapper to implement resume functionality in the scorm. As per the documentation, I've created a separate component. `import { useEffect } from "react"; import pipwerks from "pipwerks-scorm-api-wrapper";

const CourseComponent = () => { var scorm = pipwerks.SCORM;

useEffect(() => { scorm.version = "1.2"; scorm.init(); const suspendData = scorm.get("cmi.suspend_data"); const lessonLocation = scorm.get("cmi.core.lesson_location"); console.log(suspendData, lessonLocation); return () => { scorm.save(); scorm.quit(); }; }, []);

const saveProgress = (pageNumber, progressData) => { // Save the learner's progress in suspend_data scorm.set("cmi.suspend_data", JSON.stringify(progressData)); scorm.set("cmi.core.lesson_location", pageNumber); // Commit to ensure data is saved in LMS scorm.save(); };

return (

Course Content