How to modify HTMLElement after script loads / elements render?
I'm using
@solid-primitives/script-loader
to load an external component :
now, the output says collection.length: 0
even though the element is there, just that it hasn;t rendered yet.
If I wrap it into setTimeout(1000)
it'll work, but then I show the user the wrong content for a while.
onMount
also doesn't work, as it also fires before the HTML Elements are actually rendered?3 Replies
what does
script.main()
exactly do? props.onConnected()
doesn't look like it renders anything. without knowing what the script does, queueMicrotask
might work
if your script contains conditionally rendered elements like inside Show
for example, you'll have to use some sort of event notification using signals and refsthe script is from an external source and adds several new htmlelements to a div that is marked with an id.
if that script doesn't provide any way to hook into the process, choices are limited, e.g MutationObserver
might work as a last resort