From b3a3f803761d44ac0796f83a20fda7739c477001 Mon Sep 17 00:00:00 2001 From: velzie Date: Mon, 15 Jul 2024 20:21:01 -0400 Subject: [PATCH] add window.$sImport --- src/client/import.ts | 5 +++++ src/client/storage.ts | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 src/client/import.ts diff --git a/src/client/import.ts b/src/client/import.ts new file mode 100644 index 0000000..541ad58 --- /dev/null +++ b/src/client/import.ts @@ -0,0 +1,5 @@ +import { encodeUrl } from "../shared/rewriters/url" + +window.$sImport = function(url) { + return (function() { }.constructor(`return import("${encodeUrl(url)}")`))(); +} diff --git a/src/client/storage.ts b/src/client/storage.ts index 56a5fba..b218440 100644 --- a/src/client/storage.ts +++ b/src/client/storage.ts @@ -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); } },