# הבנת מחזור החיים של אובייקט DOM

**URL:** <https://meta.discourse.org/t/understanding-dom-object-lifecycle/211545>\
**Category:** Development\
**Created:** [8 בדצמבר,‏ 2021,‏ 8:57pm UTC](https://meta.discourse.org/t/understanding-dom-object-lifecycle/211545 "2021-12-08T20:57:04Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)\
**Post date:** [8 בדצמבר,‏ 2021,‏ 11:17pm UTC](https://meta.discourse.org/t/understanding-dom-object-lifecycle/211545/2 "2021-12-08T23:17:47Z")

</div>

Hey Bob 👋

Your issue is a bit beyond HTML

`<script src="https://rumbletalk.com/client/?$MY_OTHER_ID"></script>`

This script runs an [IIFE](https://developer.mozilla.org/en-US/docs/Glossary/IIFE), initializes an instance, and stores the instance in the global scope. The global scope is the same for the entire session in Discourse because it’s a single-page application. You can check that with

```javascript
console.log(RumbleTalkChat)

```

After the script loads for the first time. So, `RumbleTalkChat["$MY_OTHER_ID"]` is what the script is complaining about

```javascript
if (e.RumbleTalkChat[a.hash]) {
  throw new Error("Trying to create a duplicate chat with code: " + a.hash);
}

```

You can _try_ to remove that instance _before_ the script loads again with something like this

```javascript
delete RumbleTalkChat["$MY_OTHER_ID"]

```

Note that it doesn’t contain the `?` character.

That said, you’re probably better off if you figure out why the script is loaded multiple times in the first place. I see that the script has an `openChat()` method that you can call. So loading the script multiple times might not be necessary.

Unfortunately, you’d need to provide more details about where the embed goes and how you’re adding the markup before we can pinpoint the cause.

---

_[View the full topic](https://meta.discourse.org/t/understanding-dom-object-lifecycle/211545)._
