Access tracked variables in VanillaJS?

Looks like you’re working in gjs, so you can just use glimmer functions instead of trying to work around DOM rendering and race conditions. Add the glimmer {{on}} modifier with the iframe element and make your on loaded function fire on it.

@action
onIframeLoaded() {
...
}

...
<iframe {{on "load" this.onIframeLoaded}}