Refactor package.json and pnpm-lock.yaml to add rfdc dependency
This commit is contained in:
@@ -2,16 +2,20 @@ import { ReadableStream, WritableStream, TransformStream } from "web-streams-pol
|
||||
import { Buffer as BufferPolyfill } from 'buffer'
|
||||
import { polyfill as dragPolyfill} from "mobile-drag-drop"
|
||||
import {scrollBehaviourDragImageTranslateOverride} from 'mobile-drag-drop/scroll-behaviour'
|
||||
|
||||
import rfdc from 'rfdc'
|
||||
/**
|
||||
* Safe variant of structuredClone for svelte 5 states
|
||||
* if structuredClone is not available, it will use JSON.parse(JSON.stringify(data)) instead
|
||||
*/
|
||||
|
||||
const rfdcClone = rfdc({
|
||||
circles:false,
|
||||
})
|
||||
function safeStructuredClone<T>(data:T):T{
|
||||
try {
|
||||
return structuredClone(data)
|
||||
} catch (error) {
|
||||
return JSON.parse(JSON.stringify(data))
|
||||
return rfdcClone(data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user