aboutsummaryrefslogtreecommitdiff
path: root/packages/idb-bridge/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/idb-bridge/src/index.ts')
-rw-r--r--packages/idb-bridge/src/index.ts13
1 files changed, 12 insertions, 1 deletions
diff --git a/packages/idb-bridge/src/index.ts b/packages/idb-bridge/src/index.ts
index c4dbb8281..825d41f5e 100644
--- a/packages/idb-bridge/src/index.ts
+++ b/packages/idb-bridge/src/index.ts
@@ -20,7 +20,7 @@ import {
ObjectStoreRecord,
MemoryBackendDump,
} from "./MemoryBackend";
-import { Event } from "./idbtypes";
+import { Event, IDBKeyRange } from "./idbtypes";
import {
BridgeIDBCursor,
BridgeIDBDatabase,
@@ -90,6 +90,17 @@ export type { AccessStats } from "./MemoryBackend";
})();
/**
+ * Global indexeddb objects, either from the native or bridge-idb
+ * implementation, depending on what is availabe in
+ * the global environment.
+ */
+export const GlobalIDB: {
+ KeyRange: typeof BridgeIDBKeyRange;
+} = {
+ KeyRange: (globalThis as any).IDBKeyRange ?? BridgeIDBKeyRange,
+};
+
+/**
* Populate the global name space such that the given IndexedDB factory is made
* available globally.
*