File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -298,6 +298,18 @@ Phaser.Stage.prototype.checkVisibility = function () {
298298
299299 window . onblur = this . _onChange ;
300300 window . onfocus = this . _onChange ;
301+
302+ var _this = this ;
303+
304+ if ( this . game . device . cocoonJSApp )
305+ {
306+ CocoonJS . App . onSuspended . addEventListener ( function ( ) {
307+ Phaser . Stage . prototype . visibilityChange . call ( _this , { type : "pause" } ) ;
308+ } ) ;
309+ CocoonJS . App . onActivated . addEventListener ( function ( ) {
310+ Phaser . Stage . prototype . visibilityChange . call ( _this , { type : "resume" } ) ;
311+ } ) ;
312+ }
301313
302314} ;
303315
@@ -328,7 +340,7 @@ Phaser.Stage.prototype.visibilityChange = function (event) {
328340 return ;
329341 }
330342
331- if ( document . hidden || document . mozHidden || document . msHidden || document . webkitHidden )
343+ if ( document . hidden || document . mozHidden || document . msHidden || document . webkitHidden || event . type === "pause" )
332344 {
333345 this . game . gamePaused ( event ) ;
334346 }
You can’t perform that action at this time.
0 commit comments