Skip to content

Commit 35b4926

Browse files
committed
Undoing previous change - doesn't actually work at all! phaserjs#1620
1 parent 4699770 commit 35b4926

2 files changed

Lines changed: 4 additions & 11 deletions

File tree

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ We've also removed functions and properties from Pixi classes that Phaser doesn'
153153
* If you load an image and provide a key that was already in-use in the Cache, then the old image is now destroyed (via `Cache.removeImage`) and the new image takes its place.
154154
* BitmapText has a new `maxWidth` property that will attempt to wrap the text if it exceeds the width specified.
155155
* Group.cursorIndex is the index of the item the Group cursor points to. This replaces Group._cache[8].
156-
* Stage.visibilityChange now has a second parameter `fromPhaser`. This is set to `true` by the `Stage._onChange` callback. This should mean that when Phaser is listening for `window.onblur` and `window.onfocus` events it will only trigger the visibilityChange if that event was generated by Phaser itself. If it was generated by something else on the page or iframe it should now be ignored (thanks @austinhallock #1620)
157156

158157
### Bug Fixes
159158

src/core/Stage.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ Phaser.Stage.prototype.checkVisibility = function () {
233233
var _this = this;
234234

235235
this._onChange = function (event) {
236-
return _this.visibilityChange(event, true);
236+
return _this.visibilityChange(event);
237237
};
238238

239239
// Does browser support it? If not (like in IE9 or old Android) we need to fall back to blur/focus
@@ -251,11 +251,11 @@ Phaser.Stage.prototype.checkVisibility = function () {
251251
if (this.game.device.cocoonJSApp)
252252
{
253253
CocoonJS.App.onSuspended.addEventListener(function () {
254-
Phaser.Stage.prototype.visibilityChange.call(_this, {type: "pause"});
254+
Phaser.Stage.prototype.visibilityChange.call(_this, { type: "pause" });
255255
});
256256

257257
CocoonJS.App.onActivated.addEventListener(function () {
258-
Phaser.Stage.prototype.visibilityChange.call(_this, {type: "resume"});
258+
Phaser.Stage.prototype.visibilityChange.call(_this, { type: "resume" });
259259
});
260260
}
261261

@@ -266,14 +266,8 @@ Phaser.Stage.prototype.checkVisibility = function () {
266266
*
267267
* @method Phaser.Stage#visibilityChange
268268
* @param {Event} event - Its type will be used to decide whether the game should be paused or not.
269-
* @param {boolean} fromPhaser - Will be set if called by Phaser, will be undefined if not, causing this method to bail out early.
270269
*/
271-
Phaser.Stage.prototype.visibilityChange = function (event, fromPhaser) {
272-
273-
if (typeof fromPhaser === 'undefined' || !fromPhaser)
274-
{
275-
return;
276-
}
270+
Phaser.Stage.prototype.visibilityChange = function (event) {
277271

278272
if (event.type === 'pagehide' || event.type === 'blur' || event.type === 'pageshow' || event.type === 'focus')
279273
{

0 commit comments

Comments
 (0)