aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-02-18 11:25:23 +0100
committerFlorian Dold <florian@dold.me>2021-02-18 11:25:23 +0100
commitc800e80138358430b924937b2f4fed69376181ce (patch)
tree0039a6faa8422ecc47b1cdf370f801098943b8af
parentfe1b9efae56b093bf9cb7c27bce7252623a04a20 (diff)
idb: fix shimming
-rw-r--r--packages/idb-bridge/src/index.ts40
1 files changed, 16 insertions, 24 deletions
diff --git a/packages/idb-bridge/src/index.ts b/packages/idb-bridge/src/index.ts
index b6c15249d..2cb8bcf15 100644
--- a/packages/idb-bridge/src/index.ts
+++ b/packages/idb-bridge/src/index.ts
@@ -12,7 +12,7 @@ import {
ResultLevel,
IndexProperties,
} from "./backend-interface";
-import FakeEventTarget, { Listener } from "./util/FakeEventTarget";
+import { Listener } from "./util/FakeEventTarget";
import {
DatabaseDump,
ObjectStoreDump,
@@ -32,6 +32,7 @@ import {
BridgeIDBOpenDBRequest,
BridgeIDBRequest,
BridgeIDBTransaction,
+ BridgeIDBVersionChangeEvent,
DatabaseList,
RequestObj,
} from "./bridge-idb";
@@ -97,29 +98,20 @@ export { MemoryBackend } from "./MemoryBackend";
*/
export function shimIndexedDB(factory: BridgeIDBFactory): void {
// @ts-ignore: shimming
- globalThis.indexedDB = factory;
- // @ts-ignore: shimming
- globalThis.IDBCursor = BridgeIDBCursor;
- // @ts-ignore: shimming
- globalThis.IDBKeyRange = BridgeIDBKeyRange;
- // @ts-ignore: shimming
- globalThis.IDBDatabase = BridgeIDBDatabase;
- // @ts-ignore: shimming
- globalThis.IDBFactory = BridgeIDBFactory;
- // @ts-ignore: shimming
- globalThis.IDBIndex = BridgeIDBIndex;
- // @ts-ignore: shimming
- globalThis.IDBKeyRange = BridgeIDBKeyRange;
- // @ts-ignore: shimming
- globalThis.IDBObjectStore = BridgeIDBObjectStore;
- // @ts-ignore: shimming
- globalThis.IDBOpenDBRequest = BridgeIDBOpenDBRequest;
- // @ts-ignore: shimming
- globalThis.IDBRequest = BridgeIDBRequest;
- // @ts-ignore: shimming
- globalThis.IDBTransaction = BridgeIDBTransaction;
- // @ts-ignore: shimming
- globalThis.IDBVersionChangeEvent = BridgeIDBVersionChangeEvent;
+ const g = globalThis as any;
+
+ g.indexedDB = factory;
+ g.IDBCursor = BridgeIDBCursor;
+ g.IDBKeyRange = BridgeIDBKeyRange;
+ g.IDBDatabase = BridgeIDBDatabase;
+ g.IDBFactory = BridgeIDBFactory;
+ g.IDBIndex = BridgeIDBIndex;
+ g.IDBKeyRange = BridgeIDBKeyRange;
+ g.IDBObjectStore = BridgeIDBObjectStore;
+ g.IDBOpenDBRequest = BridgeIDBOpenDBRequest;
+ g.IDBRequest = BridgeIDBRequest;
+ g.IDBTransaction = BridgeIDBTransaction;
+ g.IDBVersionChangeEvent = BridgeIDBVersionChangeEvent;
}
export * from "./idbtypes";