Delays execution for a specified number of milliseconds using a Promise-wrapped setTimeout. Useful for pacing async operations like rate limiting or retries.
// Source: https://github.com/LeoYeAI/openclaw-master-skills | License: MIT | Copyright 2026 MyClaw.ai (LeoYeAI)
// Provided via justclaw.it.com; keep this notice with the code.
function sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key