I have a set of Astro components to be called by my App:
apps/myProject
libs/components/header
Inside the header.astro component, I have a script that I want to be run once the entire page is rendered:
<script is:inline>
console.log('hej!');
window.onload = (e) => {
console.log('loaded!');
};
</script>
The 'hej!' is being printed but not the 'loaded!'. Why is that?
For me, it is not clear how the component's lifecycle works in Astro, and I have followed this solution by adding the is:inline property to the script tag, but it still doesn't work.