# Access tracked variables in VanillaJS?

**URL:** <https://meta.discourse.org/t/access-tracked-variables-in-vanillajs/354313>\
**Category:** Development\
**Created:** [February 25, 2025, 5:17am UTC](https://meta.discourse.org/t/access-tracked-variables-in-vanillajs/354313 "2025-02-25T05:17:21Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Alteras](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alteras/32/179824_2.png) [@Alteras](https://meta.discourse.org/u/Alteras)\
**Post date:** [February 25, 2025, 6:52am UTC](https://meta.discourse.org/t/access-tracked-variables-in-vanillajs/354313/2 "2025-02-25T06:52:31Z")

</div>

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](https://guides.emberjs.com/v5.5.0/upgrading/current-edition/action-on-and-fn/#toc_the-on-modifier) with the iframe element and make your on loaded function fire on it.

```js
@action
onIframeLoaded() {
...
}

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

```

---

_[View the full topic](https://meta.discourse.org/t/access-tracked-variables-in-vanillajs/354313)._
