From 6bac2dde2faf18627d9fbda971ac6fc5695981a1 Mon Sep 17 00:00:00 2001 From: velzie Date: Sun, 1 Sep 2024 20:35:09 -0400 Subject: [PATCH] indexeddb --- src/client/shared/indexeddb.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/client/shared/indexeddb.ts diff --git a/src/client/shared/indexeddb.ts b/src/client/shared/indexeddb.ts new file mode 100644 index 0000000..1c02536 --- /dev/null +++ b/src/client/shared/indexeddb.ts @@ -0,0 +1,16 @@ +import { ScramjetClient } from "../client"; + +export default function (client: ScramjetClient, self: Self) { + client.Proxy("IDBFactory.prototype.open", { + apply(ctx) { + ctx.args[0] = `${client.url.origin}@${ctx.args[0]}`; + }, + }); + + client.Trap("IDBDatabase.prototype.name", { + get(ctx) { + let name = ctx.get() as string; + return name.substring(name.indexOf("@") + 1); + }, + }); +}