diff options
Diffstat (limited to 'packages/idb-bridge/src/util/structuredClone.ts')
-rw-r--r-- | packages/idb-bridge/src/util/structuredClone.ts | 13 |
1 files changed, 12 insertions, 1 deletions
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); } |