Skip to content

convertSyncToAsync<Arguments, Result>

Converts a synchronous function to an asynchronous one by wrapping it in a Promise.

Import:

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

Signature:

function convertSyncToAsync(syncFunction: GenericFunction<Arguments, Result>): GenericAsyncFunction<Arguments, Result>

Parameters:

ParameterTypeDescription
syncFunctionGenericFunction<Arguments, Result>The synchronous function to convert.

Returns: GenericAsyncFunction<Arguments, Result> — A function that wraps the synchronous function in an asynchronous interface.