@vpmedia/phaser 1.0.20 → 1.0.21

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.20",
3
+ "version": "1.0.21",
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",
@@ -80,6 +80,8 @@ export default class {
80
80
  this.onLockChange.dispatch('onContextStateChange', { state: this.context.state, isLocked: this.isLocked });
81
81
  if (this.isUnlockNeeded()) {
82
82
  this.addUnlockHandlers();
83
+ } else if (this.isLocked) {
84
+ this.removeUnlockHandlers();
83
85
  }
84
86
  });
85
87
  }
@@ -89,30 +91,31 @@ export default class {
89
91
  }
90
92
 
91
93
  addUnlockHandlers() {
94
+ this.isLocked = true;
92
95
  this.onLockChange.dispatch('addUnlockHandlers', { state: this.context.state, isLocked: this.isLocked });
93
96
  document.body.addEventListener('touchstart', this.onUnlockEventBinded, false);
94
97
  document.body.addEventListener('touchend', this.onUnlockEventBinded, false);
95
98
  document.body.addEventListener('click', this.onUnlockEventBinded, false);
96
99
  document.body.addEventListener('keydown', this.onUnlockEventBinded, false);
97
- this.isLocked = true;
98
100
  }
99
101
 
100
102
  removeUnlockHandlers() {
103
+ this.isLocked = false;
101
104
  this.onLockChange.dispatch('removeUnlockHandlers', { state: this.context.state, isLocked: this.isLocked });
102
105
  document.body.removeEventListener('touchstart', this.onUnlockEventBinded);
103
106
  document.body.removeEventListener('touchend', this.onUnlockEventBinded);
104
107
  document.body.removeEventListener('click', this.onUnlockEventBinded);
105
108
  document.body.removeEventListener('keydown', this.onUnlockEventBinded);
106
- this.isLocked = false;
107
109
  }
108
110
 
109
111
  onUnlockEvent(event) {
110
- this.onLockChange.dispatch('onUnlockEvent', { state: this.context.state, isLocked: this.isLocked, event });
112
+ const initialState = this.context.state;
111
113
  if (!this.isUnlockNeeded()) {
114
+ this.onLockChange.dispatch('onUnlockResumeDenied', { state: this.context.state, isLocked: this.isLocked, event });
112
115
  this.removeUnlockHandlers();
113
116
  return;
114
117
  }
115
- const initialState = this.context.state;
118
+ this.onLockChange.dispatch('onContextResumeStart', { state: this.context.state, isLocked: this.isLocked, event });
116
119
  this.context.resume().then(() => {
117
120
  this.onLockChange.dispatch('onContextResumeResult', { state: this.context.state, isLocked: this.isLocked });
118
121
  this.removeUnlockHandlers();