I want my plugin to display my UI first while I have an asynchronous function findAllElements running in the background like so:
I expected the synchronous parts of my code ie figma.showUI() to run first while findAllElements() is running in the background, but it seems like figma.showUI() is still waiting for findAllElements() to complete before the UI is displayed.
How do I use promises to get the behaviour I want? Also, would it be better to make use of custom events to load my background tasks instead?