Unity3DTiles.jslib 746 B

123456789101112131415161718192021222324
  1. mergeInto(LibraryManager.library, {
  2. //based on https://stackoverflow.com/a/901144
  3. getURLParameter: function(name) {
  4. name = Pointer_stringify(name);
  5. name = name.replace(/[\[\]]/g, '\\$&');
  6. const regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)');
  7. const results = regex.exec(window.location.href);
  8. const val = results && results[2] ? decodeURIComponent(results[2].replace(/\+/g, ' ')) : '';
  9. const sz = lengthBytesUTF8(val) + 1;
  10. const buf = _malloc(sz);
  11. stringToUTF8(val, buf, sz);
  12. return buf;
  13. },
  14. getWindowLocationURL: function() {
  15. const val = window.location.href;
  16. const sz = lengthBytesUTF8(val) + 1;
  17. const buf = _malloc(sz);
  18. stringToUTF8(val, buf, sz);
  19. return buf;
  20. },
  21. });