aboutsummaryrefslogtreecommitdiff
path: root/packages/idb-bridge
diff options
context:
space:
mode:
Diffstat (limited to 'packages/idb-bridge')
-rw-r--r--packages/idb-bridge/package.json2
-rw-r--r--packages/idb-bridge/src/util/structuredClone.ts13
2 files changed, 13 insertions, 2 deletions
diff --git a/packages/idb-bridge/package.json b/packages/idb-bridge/package.json
index b93ca9f0d..9a58b8695 100644
--- a/packages/idb-bridge/package.json
+++ b/packages/idb-bridge/package.json
@@ -22,7 +22,7 @@
}
},
"devDependencies": {
- "@types/node": "^18.8.5",
+ "@types/node": "^18.11.17",
"ava": "^4.3.3",
"esm": "^3.2.25",
"prettier": "^2.5.1",
diff --git a/packages/idb-bridge/src/util/structuredClone.ts b/packages/idb-bridge/src/util/structuredClone.ts
index c33dc5e36..5ed269db3 100644
--- a/packages/idb-bridge/src/util/structuredClone.ts
+++ b/packages/idb-bridge/src/util/structuredClone.ts
@@ -425,6 +425,11 @@ export function structuredRevive(val: any): any {
* Structured clone for IndexedDB.
*/
export function structuredClone(val: any): any {
+ // @ts-ignore
+ if (globalThis._tart?.structuredClone) {
+ // @ts-ignore
+ return globalThis._tart?.structuredClone(val);
+ }
return mkDeepClone()(val);
}
@@ -432,5 +437,11 @@ export function structuredClone(val: any): any {
* Structured clone for IndexedDB.
*/
export function checkStructuredCloneOrThrow(val: any): void {
- return mkDeepCloneCheckOnly()(val);
+ // @ts-ignore
+ if (globalThis._tart?.structuredClone) {
+ // @ts-ignore
+ globalThis._tart?.structuredClone(val);
+ return;
+ }
+ mkDeepCloneCheckOnly()(val);
}