Skip to content

convertSyncToAsync<Args, 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(syncFn: GenericFunction<Args, Result>): GenericAsyncFunction<Args, Result>

Parameters:

ParameterTypeDescription
syncFnGenericFunction<Args, Result>The synchronous function to convert.

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