# Call Phaser function from outside game?

**URL:** <https://phaser.discourse.group/t/call-phaser-function-from-outside-game/9114>\
**Category:** Phaser 3\
**Created:** [March 15, 2021, 9:20am UTC](https://phaser.discourse.group/t/call-phaser-function-from-outside-game/9114 "2021-03-15T09:20:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmcintosh](https://avatars.discourse-cdn.com/v4/letter/b/ebca7d/32.png) [@bmcintosh](https://phaser.discourse.group/u/bmcintosh)\
**Post date:** [March 15, 2021, 9:20am UTC](https://phaser.discourse.group/t/call-phaser-function-from-outside-game/9114/1 "2021-03-15T09:20:00Z")

</div>

Does anyone know how to call a Phaser function from outside the game? I put a window.addEventListener into a game, but it is not registering.

Regards,  
Brian

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [March 15, 2021, 5:55pm UTC](https://phaser.discourse.group/t/call-phaser-function-from-outside-game/9114/2 "2021-03-15T17:55:11Z")

</div>

👋

Post your code, please?

---

<div class="post-metadata">

**Author:** ![andyliu](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/andyliu/32/4942_2.png) [@andyliu](https://phaser.discourse.group/u/andyliu)\
**Post date:** [March 16, 2021, 9:09am UTC](https://phaser.discourse.group/t/call-phaser-function-from-outside-game/9114/3 "2021-03-16T09:09:48Z")

</div>

create global Phaser EventEmitter, emit event and on this event.

 ![raycast-untitled (1)](https://global.discourse-cdn.com/free1/uploads/phaser1/original/2X/2/24e6c12cf59bdb0a32bae8db69b52fe0860e6c20.png)

---

<div class="post-metadata">

**Author:** ![ReydVires](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/reydvires/32/939_2.png) [@ReydVires](https://phaser.discourse.group/u/ReydVires)\
**Post date:** [March 16, 2021, 2:06pm UTC](https://phaser.discourse.group/t/call-phaser-function-from-outside-game/9114/4 "2021-03-16T14:06:18Z")

</div>

Do you emit the event, right before it’s registered?
