Sleep
Pauses the execution for a specified duration.
| Category | Functions |
| Author | Pol Gubau |
| Since | 1.0.0 |
| Last Updated | 2025-03-15 |
| Type | Async |
| Compatibility | Universal |
Example
Input
await sleep(1000)Output:
Pauses execution for 1000 milliseconds.
Return
Resolves after the specified duration.
Type: void
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| ms | number | `${number}ms` | null | Yes | The duration to sleep, in milliseconds or a string representing milliseconds. |
Notes
The `ms` parameter can be either a number (in milliseconds) or a string with the format `${number}ms`.
Tags
- sleep
- delay
- timeout