add window.$sImport

This commit is contained in:
velzie 2024-07-15 20:21:01 -04:00
parent c4f31be3ae
commit b3a3f80376
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F
2 changed files with 9 additions and 0 deletions

5
src/client/import.ts Normal file
View file

@ -0,0 +1,5 @@
import { encodeUrl } from "../shared/rewriters/url"
window.$sImport = function(url) {
return (function() { }.constructor(`return import("${encodeUrl(url)}")`))();
}

View file

@ -42,6 +42,10 @@ function storageProxy(scope: Storage): Storage {
case "length":
return store.size;
default:
if (prop in Object.prototype) {
return Reflect.get(target, prop);
}
return store.get(prop);
}
},