# Events Getting Backed Up On Tabbing Away

**URL:** <https://phaser.discourse.group/t/events-getting-backed-up-on-tabbing-away/1538>\
**Category:** Phaser 3\
**Created:** [March 5, 2019, 9:16pm UTC](https://phaser.discourse.group/t/events-getting-backed-up-on-tabbing-away/1538 "2019-03-05T21:16:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Quintis](https://avatars.discourse-cdn.com/v4/letter/q/57b2e6/32.png) [@Quintis](https://phaser.discourse.group/u/Quintis)\
**Post date:** [March 5, 2019, 9:16pm UTC](https://phaser.discourse.group/t/events-getting-backed-up-on-tabbing-away/1538/1 "2019-03-05T21:16:51Z")

</div>

I am pretty new to Phaser 3, but I general problem I have been having is timed events getting backed up when someone tabs away on their browser. When they tab back, every event that would have triggered while they were on a different tab triggers at once. Is there a way to get these events to continue triggering while tabbed away? If not is there a way to detect tabbing away to pause the game or something? Thank you for any suggestions.

---

<div class="post-metadata">

**Author:** ![FKL34TI5T5](https://avatars.discourse-cdn.com/v4/letter/f/df788c/32.png) [@FKL34TI5T5](https://phaser.discourse.group/u/FKL34TI5T5)\
**Post date:** [March 6, 2019, 10:59am UTC](https://phaser.discourse.group/t/events-getting-backed-up-on-tabbing-away/1538/2 "2019-03-06T10:59:14Z")

</div>

If you can post some code, that would be helpful. I have zero idea how it works because there are no examples floating around on Phaser 3 events when it comes to: [https://photonstorm.github.io/phaser3-docs/Phaser.Core.Events.html#event:VISIBLE\_\_anchor](https://photonstorm.github.io/phaser3-docs/Phaser.Core.Events.html#event:VISIBLE__anchor)

I assume many are in the same predicament. Even the wrong answer is better than no answer.

---

<div class="post-metadata">

**Author:** ![Quintis](https://avatars.discourse-cdn.com/v4/letter/q/57b2e6/32.png) [@Quintis](https://phaser.discourse.group/u/Quintis)\
**Post date:** [March 6, 2019, 1:14pm UTC](https://phaser.discourse.group/t/events-getting-backed-up-on-tabbing-away/1538/3 "2019-03-06T13:14:06Z")

</div>

I actually figured out how to do it properly so it didn’t back up! Simplifying and playing with it awhile from scratch worked out.  
Running Test:  
[https://www.quintisgames.com/phaserTimerTest/phaserTimerTest.html](https://www.quintisgames.com/phaserTimerTest/phaserTimerTest.html)

**Core code:**  
var timer = this.time.addEvent({  
delay: 500,  
callback: addFaller,  
callbackScope: this,  
loop: true  
});

function addFaller(){…}

I was going to put in a file download as well, but I can’t since I am a new user so you can go here for the zip (It will auto-download and redirect here):  
[https://www.quintisgames.com/phaserTimerTest/download.html](https://www.quintisgames.com/phaserTimerTest/download.html)

---

<div class="post-metadata">

**Author:** ![FKL34TI5T5](https://avatars.discourse-cdn.com/v4/letter/f/df788c/32.png) [@FKL34TI5T5](https://phaser.discourse.group/u/FKL34TI5T5)\
**Post date:** [March 6, 2019, 3:39pm UTC](https://phaser.discourse.group/t/events-getting-backed-up-on-tabbing-away/1538/4 "2019-03-06T15:39:54Z")

</div>

I see what you mean now, I think this is the correct solution as setInterval and recursive calls have some unintended side effects.

I am having a slightly different problem in that when it returns, I can’t get it to not play anything if the action was paused for more than a few seconds. I thought that might be the struggle, and I have no answer for this yet.
