Skip to content

Commit 4699770

Browse files
committed
Adjusted function order.
1 parent 9effb4a commit 4699770

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

src/core/Stage.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -230,26 +230,24 @@ Phaser.Stage.prototype.checkVisibility = function () {
230230
this._hiddenVar = null;
231231
}
232232

233-
// Does browser support it? If not (like in IE9 or old Android) we need to fall back to blur/focus
234-
if (this._hiddenVar)
235-
{
236-
document.addEventListener(this._hiddenVar, this._onChange, false);
237-
}
238-
239233
var _this = this;
240234

241235
this._onChange = function (event) {
242236
return _this.visibilityChange(event, true);
243237
};
244238

239+
// Does browser support it? If not (like in IE9 or old Android) we need to fall back to blur/focus
240+
if (this._hiddenVar)
241+
{
242+
document.addEventListener(this._hiddenVar, this._onChange, false);
243+
}
244+
245245
window.onblur = this._onChange;
246246
window.onfocus = this._onChange;
247247

248248
window.onpagehide = this._onChange;
249249
window.onpageshow = this._onChange;
250250

251-
var _this = this;
252-
253251
if (this.game.device.cocoonJSApp)
254252
{
255253
CocoonJS.App.onSuspended.addEventListener(function () {

0 commit comments

Comments
 (0)