Skip to content

Commit b4db773

Browse files
committed
add type parameter to Numbas.loadStandaloneScript
1 parent e5a9a55 commit b4db773

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

runtime/scripts/numbas.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,13 @@ Numbas.getStandaloneFileURL = function(extension, path) {
249249
*
250250
* @param {string} extension - The name of the extension.
251251
* @param {string} path - The path to the script, relative to the extension's `standalone_scripts` folder.
252+
* @param {string} [type] - The type of the script, such as `"module"`.
252253
*/
253-
Numbas.loadStandaloneScript = function(extension, path) {
254+
Numbas.loadStandaloneScript = function(extension, path, type) {
254255
var script = document.createElement('script');
256+
if(type) {
257+
script.setAttribute('type',type);
258+
}
255259
script.setAttribute('src', Numbas.getStandaloneFileURL(extension, path));
256260
document.head.appendChild(script);
257261
}

0 commit comments

Comments
 (0)