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:
| Parameter | Type | Description |
|---|---|---|
asyncFunc | GenericAsyncFunction<Args> | The asynchronous function to convert. |
stackTrace | string | undefined | The stack trace of the source function. |
Returns: GenericVoidFunction<Args> — A function that wraps the asynchronous function in a synchronous interface.
Links to this page: