MCPcopy Index your code
hub / github.com/CopilotKit/CopilotKit / waitForCondition

Function waitForCondition

packages/core/src/__tests__/test-utils.ts:236–248  ·  view source on GitHub ↗
(
  condition: () => boolean,
  timeout: number = 1000,
  interval: number = 10,
)

Source from the content-addressed store, hash-verified

234}
235
236export async function waitForCondition(
237 condition: () => boolean,
238 timeout: number = 1000,
239 interval: number = 10,
240): Promise<void> {
241 const start = Date.now();
242 while (!condition()) {
243 if (Date.now() - start > timeout) {
244 throw new Error("Timeout waiting for condition");
245 }
246 await new Promise((resolve) => setTimeout(resolve, interval));
247 }
248}
249
250/**
251 * Helper to create a dynamic suggestions config

Calls 1

nowMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…