User:Uraxys/common.js: Difference between revisions

From Idle Clans wiki
No edit summary
Tag: Manual revert
No edit summary
Line 3: Line 3:


// local IDE  
// local IDE  
mw.loader.load('http://mediawiki.localhost/src/mediawiki.js');
//mw.loader.load('http://mediawiki.localhost/src/mediawiki.js');
 
var wasm_base64;
var wasm_buffer;
var wasm;
var wasm_instance;
function hw() {
wasm_base64 = "AGFzbQEAAAABBwFgAnx8AXwDAgEABwoBBm15X2FkZAAACgkBBwAgACABoAs=";
wasm_buffer = Uint8Array.from(atob(wasm_base64), function (c) { return c.charCodeAt(0); }).buffer;
WebAssembly.compile(wasm_buffer).then(function(x) {
wasm = x;
wasm_instance = new WebAssembly.Instance(wasm);
var x = wasm_instance.exports.my_add(2,2);
console.log("2+2 = ",x);
});
}
hw();

Revision as of 07:44, 12 June 2024

// Testing
// mw.loader.load('//wiki.idleclans.com/index.php?title=User:Uraxys/scripts/test.js&action=raw&ctype=text/javascript');

// local IDE 
//mw.loader.load('http://mediawiki.localhost/src/mediawiki.js');

var wasm_base64;
var wasm_buffer;
var wasm;
var wasm_instance;
function hw() {
	wasm_base64 = "AGFzbQEAAAABBwFgAnx8AXwDAgEABwoBBm15X2FkZAAACgkBBwAgACABoAs=";
	wasm_buffer = Uint8Array.from(atob(wasm_base64), function (c) { return c.charCodeAt(0); }).buffer;
	WebAssembly.compile(wasm_buffer).then(function(x) {
		wasm = x;
		wasm_instance = new WebAssembly.Instance(wasm);
		var x = wasm_instance.exports.my_add(2,2);
		console.log("2+2 = ",x);
	});
}
hw();