#Run function first

3 messages · Page 1 of 1 (latest)

granite cypress
#

Can you suggest a way to ensure that this function runs before any other scripts run? I'm not using view transitions
await setColorPalette(activities[0])

tawdry cosmosBOT
#

Hi @granite cypress. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

I'm sorry, but the provided knowledge sources do not contain information on how to ensure a specific function runs before all other scripts in a standard Astro project without using view transitions.

The documentation provided focuses specifically on script behavior with view transitions, detailng how to use lifecycle events like astro:page-load or astro:after-swap, and how to use the data-astro-rerun attribute for inline scripts [Script re-execution].

While the sources mention that "scripts are run in sequential order to match browser behavior" [Script behavior], they do not explicitly define a mechanism for global script prioritization or blocking execution for an asynchronous function like await setColorPalette() outside of the view transitions context.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: