Hi,
I am an educator at a tertiary institute in Singapore and we are exploring Adapt Learning as an alternative to proprietary mobile/elearning tools.
I am trying to establish that being open source means the school can extend the capability of the tool.
I am attempting to send data to SurveyJS using a plugin. Aim is to keep track of students' progress real-time by querying the SurveyJS database periodically.
I am using the authoring tool and not solely the framework.
The following code works on a browser i.e. uses XMLHttpRequest to send data to my SurveyJS database.
Posting to SurveyJS by running script in browser:
I downloaded the adapt-textConfirmation plugin from this thread (https://community.adaptlearning.org/mod/forum/discuss.php?d=2092), and I tried to put in the same code.
Original code screenshot of adapt-textConfirmation.js:
As the code needs XMLHttpRequest, but it seems that the framework that comes with the authoring tool does not have XMLHttpRequest, I downloaded the XMLHttpRequest package using npm, and copied it into the same folder as adapt-textConfirmation.js. Then I rewrote the code in front so that adapt-textConfirmation.js can find XMLHttpRequest.
My attempt at copying and pasting the working code into the plugin:
File structure:
However, when running the preview, this error came out:
I opened XMLHttpRequest.js and realized that it requires the package "url".
I stopped attempting after downloading using npm and copying the package "url" to the same folder as adapt-textConfirmation.js because there is always some other modules that is missing, and I doubt it is good practice to manually copy node modules to the same folder.
My question hence is this: what is the correct way to require node modules like XMLHttpRequest (which has its own dependencies) when creating a plugin? Can I download new modules to the adapt framework exported with each stand-alone course or is there some other way?
I would appreciate any advice. Thanks in advance!