Skip to content

convertAsyncToSync<Arguments>

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(asyncFunction: GenericAsyncFunction<Arguments>, stackTrace: string | undefined): GenericVoidFunction<Arguments>

Parameters:

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

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


Links to this page: