@vpmedia/phaser 1.0.21 → 1.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpmedia/phaser",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2",
5
5
  "author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
6
6
  "license": "MIT",
@@ -73,12 +73,12 @@ export default class {
73
73
  this.masterGain.connect(this.context.destination);
74
74
  // handle audio state unlock
75
75
  this.onUnlockEventBinded = this.onUnlockEvent.bind(this);
76
- if (this.isUnlockNeeded()) {
76
+ if (this.context.state === 'suspended' || this.context.state === 'interrupted') {
77
77
  this.addUnlockHandlers();
78
78
  }
79
79
  this.context.addEventListener('statechange', () => {
80
80
  this.onLockChange.dispatch('onContextStateChange', { state: this.context.state, isLocked: this.isLocked });
81
- if (this.isUnlockNeeded()) {
81
+ if (!this.isLocked && (this.context.state === 'suspended' || this.context.state === 'interrupted')) {
82
82
  this.addUnlockHandlers();
83
83
  } else if (this.isLocked) {
84
84
  this.removeUnlockHandlers();
@@ -86,10 +86,6 @@ export default class {
86
86
  });
87
87
  }
88
88
 
89
- isUnlockNeeded() {
90
- return !this.isLocked && !this.noAudio && (this.context.state === 'suspended' || this.context.state === 'interrupted');
91
- }
92
-
93
89
  addUnlockHandlers() {
94
90
  this.isLocked = true;
95
91
  this.onLockChange.dispatch('addUnlockHandlers', { state: this.context.state, isLocked: this.isLocked });
@@ -110,7 +106,7 @@ export default class {
110
106
 
111
107
  onUnlockEvent(event) {
112
108
  const initialState = this.context.state;
113
- if (!this.isUnlockNeeded()) {
109
+ if (this.context.state !== 'suspended' && this.context.state !== 'interrupted') {
114
110
  this.onLockChange.dispatch('onUnlockResumeDenied', { state: this.context.state, isLocked: this.isLocked, event });
115
111
  this.removeUnlockHandlers();
116
112
  return;