mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 14:08:28 +00:00
Don't create a promise unless the context exists
This commit is contained in:
parent
cfe6452924
commit
ba381f8e3d
1 changed files with 10 additions and 7 deletions
|
@ -147,14 +147,17 @@ var WebAudioSoundManager = new Class({
|
|||
|
||||
var unlockHandler = function unlockHandler ()
|
||||
{
|
||||
_this.context.resume().then(function ()
|
||||
if (_this.context)
|
||||
{
|
||||
document.body.removeEventListener('touchstart', unlockHandler);
|
||||
document.body.removeEventListener('touchend', unlockHandler);
|
||||
document.body.removeEventListener('click', unlockHandler);
|
||||
|
||||
_this.unlocked = true;
|
||||
});
|
||||
_this.context.resume().then(function ()
|
||||
{
|
||||
document.body.removeEventListener('touchstart', unlockHandler);
|
||||
document.body.removeEventListener('touchend', unlockHandler);
|
||||
document.body.removeEventListener('click', unlockHandler);
|
||||
|
||||
_this.unlocked = true;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (document.body)
|
||||
|
|
Loading…
Add table
Reference in a new issue