Skip to content

convertAsyncToSync<Args>

Converts an asynchronous function to a synchronous one by automatically handling the Promise rejection.

Import:

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

Signature:

function convertAsyncToSync(asyncFunc: GenericAsyncFunction<Args>, stackTrace: string | undefined): GenericVoidFunction<Args>

Parameters:

ParameterTypeDescription
asyncFuncGenericAsyncFunction<Args>The asynchronous function to convert.
stackTracestring | undefinedThe stack trace of the source function.

Returns: GenericVoidFunction<Args> — A function that wraps the asynchronous function in a synchronous interface.


Links to this page: