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); + }, + }); +}