Skip to content

runWithTimeout<Result>

Executes a function with a timeout. If the function does not complete within the specified time, it is considered to have timed out.

If DEBUG=obsidian-dev-utils:Async:runWithTimeout is set, the execution is not terminated after the timeout and the function is allowed to run indefinitely.

Import:

import { runWithTimeout } from 'obsidian-dev-utils/async';

Signature:

function runWithTimeout(params: RunWithTimeoutParams<Result>): Promise<Result>

Parameters:

ParameterTypeDescription
paramsRunWithTimeoutParams<Result>The parameters for the function.

Returns: Promise<Result> — A Promise that resolves with the result of the asynchronous function or rejects if it times out.


Links to this page: