# SOLVED: Nodes registered as different names dont show in node-red at same time

**URL:** <https://discourse.nodered.org/t/solved-nodes-registered-as-different-names-dont-show-in-node-red-at-same-time/24459>\
**Category:** General\
**Created:** [8 April 2020 12:42 UTC](https://discourse.nodered.org/t/solved-nodes-registered-as-different-names-dont-show-in-node-red-at-same-time/24459 "2020-04-08T12:42:45Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [8 April 2020 13:24 UTC](https://discourse.nodered.org/t/solved-nodes-registered-as-different-names-dont-show-in-node-red-at-same-time/24459/7 "2020-04-08T13:24:37Z")

</div>

> [@Steve-Mcl](#):
>
> do you have any recommendations to avoid this kind of conflict like "dont put constants at top level, put them ...." (no worries if you dont have the time)

Yup. Don't put constants at the top level.

Best to wrap you entire code in a function so everything is scoped within the function...

```auto
<script type="text/javascript">
(function() {

    const DEFAULT_WIDTH = 160
	RED.nodes.registerType('image viewer', {
        ...
    }

})();
</script>
```

---

_[View the full topic](https://discourse.nodered.org/t/solved-nodes-registered-as-different-names-dont-show-in-node-red-at-same-time/24459)._
