|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
586 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Returns a promise that rejects with a `TimeoutError` after a specified delay.
|
|---|
| 3 | *
|
|---|
| 4 | * @param {number} ms - The delay duration in milliseconds.
|
|---|
| 5 | * @returns {Promise<never>} A promise that rejects with a `TimeoutError` after the specified delay.
|
|---|
| 6 | * @throws {TimeoutError} Throws a `TimeoutError` after the specified delay.
|
|---|
| 7 | *
|
|---|
| 8 | * @example
|
|---|
| 9 | * try {
|
|---|
| 10 | * await timeout(1000); // Timeout exception after 1 second
|
|---|
| 11 | * } catch (error) {
|
|---|
| 12 | * console.error(error); // Will log 'The operation was timed out'
|
|---|
| 13 | * }
|
|---|
| 14 | */
|
|---|
| 15 | declare function timeout(ms: number): Promise<never>;
|
|---|
| 16 |
|
|---|
| 17 | export { timeout };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.