SoundManager.destroy doesn't close the context if it's being stored in PhaserGlobal (thanks @brianbunch #2356)

This commit is contained in:
photonstorm 2016-02-26 13:31:45 +00:00
parent cc3a07bada
commit 15d952171c
2 changed files with 15 additions and 9 deletions

View file

@ -331,7 +331,8 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
* The `mouseoutglobal` event listener wasn't removed when the game was destroyed (thanks @stoneman1 #2345 #2344 #2342)
* Fixed issue with IE crashing on this.context.close in the Sound Manager (thanks @stoneman1 #2349)
* Phaser.World.centerX and Phaser.World.centerY only worked if the bounds had an origin of 0, 0. They now take into account the actual origin (thanks @fillmoreb #2353)
* SoundManager.close now validates that context.close is a valid function before calling it (thanks @brianbunch #2355)
* SoundManager.destroy now validates that context.close is a valid function before calling it (thanks @brianbunch #2355)
* SoundManager.destroy doesn't close the context if it's being stored in PhaserGlobal (thanks @brianbunch #2356)
### Pixi Updates

View file

@ -730,15 +730,20 @@ Phaser.SoundManager.prototype = {
this.onSoundDecode.dispose();
if (this.context && this.context.close)
if (this.context)
{
this.context.close();
}
if (this.context && window['PhaserGlobal'])
{
// Store this in the PhaserGlobal window var, if set, to allow for re-use if the game is created again without the page refreshing
window['PhaserGlobal'].audioContext = this.context;
if (window['PhaserGlobal'])
{
// Store this in the PhaserGlobal window var, if set, to allow for re-use if the game is created again without the page refreshing
window['PhaserGlobal'].audioContext = this.context;
}
else
{
if (this.context.close)
{
this.context.close();
}
}
}
}