User:Evad37/sandbox3.js

/* This is Evad37's Javascript sandbox – a testing spot for small bits of js code */

// ES6 module loading test // This script loads a script module (which itself imports another module) // and places it inside tags

/* jshint esnext:false, esversion: 6, laxbreak: true, undef: true, eqnull: true, maxerr: 999 */ /* globals console, document, File, FileReader, fetch, window, $, mw, OO */

// Based on https://doc.wikimedia.org/mediawiki-core/master/js/source/mediawiki.loader.html#mw-loader-method-addScript $.ready.then( => {	let script = document.createElement( 'script' );	script.setAttribute("type", "module");	script.src = "https://en.wikipedia.org/wiki/User:Evad37/sandbox.js?action=raw&ctype=text/javascript";	script.onload = script.onerror = function {		if ( script.parentNode ) {			script.parentNode.removeChild( script );		}		console.log("ES6 module loaded (or error)");	};	document.head.appendChild( script ); });