# EmojiPicker stores state in global module-level variables

**URL:** <https://meta.discourse.org/t/emojipicker-stores-state-in-global-module-level-variables/70056>\
**Category:** Bug\
**Created:** [2017 年 9 月 14 日午後 3:44 UTC](https://meta.discourse.org/t/emojipicker-stores-state-in-global-module-level-variables/70056 "2017-09-14T15:44:03Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![schungx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schungx/32/70989_2.png) [@schungx](https://meta.discourse.org/u/schungx)\
**Post date:** [2017 年 9 月 15 日午前 5:08 UTC](https://meta.discourse.org/t/emojipicker-stores-state-in-global-module-level-variables/70056/7 "2017-09-15T05:08:41Z")

</div>

No worries mate. JS can be a b\*\*ch to pick up.

What you really need is to move those module-global variables into the class definition, so they are class-instance properties.

Then change all the access from `$picker` to `this.$picker` etc.

Then Bob’s your uncle! 🕶

P.S. I could have made the changes myself and submit a PR, but I got scared of forking the entire Discourse repo just to test such small changes…

---

_[View the full topic](https://meta.discourse.org/t/emojipicker-stores-state-in-global-module-level-variables/70056)._
