I understand there is no way to get the return result of an async function in top-level code (this is within a
.ts
.ts
file).
Now I know some of you might suggest resources, however, I only need to use these async functions at app launch (aka once and never again), and they are all extremely fast (<10ms) so I do not need to use Suspense or add a loading indicator to my GUI.
The only solution I can think of at the moment is initializing properties like
path
path
and
view
view
with "dummy" values and then within an async-friendly initialization point such as
onMount
onMount
, populating said properties with their real values fetched from the async functions.
Using dummy values is a really crappy solution in my opinion so I would be so grateful if somebody had a neat solution to this issue. Coming from lower-level languages like Rust, the lack of control over synchronization drives me insane in these frontend frameworks.