You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

20 lines
704 B

mergeInto(LibraryManager.library, {
GetURLFromPage: function () {
var returnStr = window.top.location.href;
var bufferSize = lengthBytesUTF8(returnStr) + 1
var buffer = _malloc(bufferSize);
stringToUTF8(returnStr, buffer, bufferSize);
return buffer;
},
GetQueryParam: function(paramId) {
var urlParams = new URLSearchParams(location.search);
var param = urlParams.get(Pointer_stringify(paramId));
console.log("JavaScript read param: " + param);
var bufferSize = lengthBytesUTF8(param) + 1;
var buffer = _malloc(bufferSize);
stringToUTF8(param, buffer, bufferSize);
return buffer;
}
});