In Obsidian TypeScript, how do I call an async function from a synchonous function?

I am writing a plugin in TypeScript for the Obsidian notetaking app (PC and mobile). I have functions that are triggered by Commands and Events (which are synchronous) and I would like to update Note files (and these API calls are all async/await).

Is there any kind of async runner that would let me do this?

Note: worker threads will not work as they run in their own address space.

Also, node is only available on PC (for Obsidian).

You shouldn’t need any sort of dedicated async runner, it should “just work”, are you experiencing issues with calling async functions from a sync context? Can you provide an example?

This is TypeScript basics, to run an asynchronous operation in a synchronous context, use:

void asyncOperation(); // asyncOperation() returns a Promise

This is equivalent to asyncOperation() directly without void, but void satisfies linters.

Promise lifecycle tracking:

void asyncOperation().then(/* ... */);
void asyncOperation().catch(/* ... */);
void asyncOperation().finally(/* ... */);