dynamic-forms-primeng / Function

delay

Creates a promise that resolves after the specified delay.

Utility function for testing scenarios where you need to wait for asynchronous operations, animations, or timing-dependent behavior.

Presentation

function delay(ms: number = 0): Promise<void>;

Returns

Promise<void> -

Promise that resolves after the specified delay

Parameters

NameTypeDescription
ms
number

Delay in milliseconds (defaults to 0 for next tick)

Example usage

// Wait for async operations in tests
await delay(100);
expect(component.isLoaded).toBe(true);

// Wait for next tick (micro-task)
await delay();
fixture.detectChanges();