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.

19 lines
704 B

  1. mergeInto(LibraryManager.library, {
  2. GetURLFromPage: function () {
  3. var returnStr = window.top.location.href;
  4. var bufferSize = lengthBytesUTF8(returnStr) + 1
  5. var buffer = _malloc(bufferSize);
  6. stringToUTF8(returnStr, buffer, bufferSize);
  7. return buffer;
  8. },
  9. GetQueryParam: function(paramId) {
  10. var urlParams = new URLSearchParams(location.search);
  11. var param = urlParams.get(Pointer_stringify(paramId));
  12. console.log("JavaScript read param: " + param);
  13. var bufferSize = lengthBytesUTF8(param) + 1;
  14. var buffer = _malloc(bufferSize);
  15. stringToUTF8(param, buffer, bufferSize);
  16. return buffer;
  17. }
  18. });