mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-06-26 18:26:38 +00:00
26 lines
581 B
TypeScript
26 lines
581 B
TypeScript
import { getIFrameSimulationData } from '~/lib/replay/Recording';
|
|
import { getCurrentIFrame } from '~/components/workbench/Preview';
|
|
import { simulationAddData } from '~/lib/replay/ChatManager';
|
|
|
|
export async function flushSimulationData() {
|
|
const iframe = getCurrentIFrame();
|
|
|
|
if (!iframe) {
|
|
return;
|
|
}
|
|
|
|
const simulationData = await getIFrameSimulationData(iframe);
|
|
|
|
if (!simulationData.length) {
|
|
return;
|
|
}
|
|
|
|
simulationAddData(simulationData);
|
|
}
|
|
|
|
export function setupSimulationInterval() {
|
|
setInterval(async () => {
|
|
flushSimulationData();
|
|
}, 1000);
|
|
}
|