Timeout¶
Executes the given callback function within a specified time limit (in milliseconds).
1 |
|
Parameters¶
() => void fn
The callback function to execute.
number milliseconds
The maximum time (in milliseconds) to execute the callback function.
Returns¶
The result of the callback function if it completes within the specified time limit; otherwise, null
.
Remarks¶
If the function completes within the given time limit, the function returns the callback result. Otherwise, it returns null
.
Example¶
1 2 3 4 |
|