Wait Utilities

Table of Contents
Functions
wait
waitFrames

Description

The wait utilities module provides functions for creating delays and waiting for animation frames, useful for timing operations and animations.

wait

Creates a promise that resolves after a specified number of milliseconds.

import { wait } from '../src/utils/wait.js';

// Wait for 1 second
await wait(1000);
console.log('This runs after 1 second');

waitFrames

Creates a promise that resolves after a specified number of animation frames.

import { waitFrames } from '../src/utils/wait.js';

// Wait for 2 animation frames
await waitFrames(2);
console.log('This runs after 2 frames');