@vpmedia/phaser 1.29.0 → 1.30.0

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @vpmedia/phaser
2
2
 
3
- [![npm version](https://badge.fury.io/js/@vpmedia%2Fphaser.svg?v=1.29.0)](https://badge.fury.io/js/@vpmedia%2Fphaser)
3
+ [![npm version](https://badge.fury.io/js/@vpmedia%2Fphaser.svg?v=1.30.0)](https://badge.fury.io/js/@vpmedia%2Fphaser)
4
4
  [![Node.js CI](https://github.com/vpmedia/phaser/actions/workflows/node.js.yml/badge.svg)](https://github.com/vpmedia/phaser/actions/workflows/node.js.yml)
5
5
 
6
6
  @vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpmedia/phaser",
3
- "version": "1.29.0",
3
+ "version": "1.30.0",
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",
@@ -22,11 +22,11 @@
22
22
  "main": "./src/index.js",
23
23
  "types": "./types/index.d.ts",
24
24
  "devDependencies": {
25
- "eslint": "^8.41.0",
25
+ "eslint": "^8.42.0",
26
26
  "eslint-config-prettier": "^8.8.0",
27
27
  "eslint-plugin-import": "^2.27.5",
28
28
  "eslint-plugin-jest": "^27.2.1",
29
- "eslint-plugin-jsdoc": "^46.1.0",
29
+ "eslint-plugin-jsdoc": "^46.2.5",
30
30
  "eslint-plugin-prettier": "^4.2.1",
31
31
  "husky": "^8.0.3",
32
32
  "jest": "^29.5.0",
@@ -15,7 +15,7 @@ export class Loader {
15
15
  this.isLoading = false;
16
16
  this.isUseLog = false;
17
17
  this.isUseRetry = true;
18
- this.maxRetry = 1;
18
+ this.maxRetry = 3;
19
19
  this.hasLoaded = false;
20
20
  this.preloadSprite = null;
21
21
  this.crossOrigin = false;
@@ -795,8 +795,10 @@ export class Loader {
795
795
  };
796
796
  file.data.onerror = () => {
797
797
  if (scope.isUseRetry && (!file.numRetry || file.numRetry < scope.maxRetry)) {
798
- file.numRetry = !file.numRetry ? 1 : (file.numRetry += 1);
799
- scope.loadImageTag(file);
798
+ setTimeout(() => {
799
+ file.numRetry = !file.numRetry ? 1 : (file.numRetry += 1);
800
+ scope.loadImageTag(file);
801
+ }, 1000);
800
802
  } else if (file.data.onload) {
801
803
  file.data.onload = null;
802
804
  file.data.onerror = null;
@@ -832,8 +834,10 @@ export class Loader {
832
834
  if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599) {
833
835
  // Handle HTTP status codes of 4xx and 5xx as errors, even if xhr.onerror was not called.
834
836
  if (scope.isUseRetry && (!file.numRetry || file.numRetry < scope.maxRetry)) {
835
- file.numRetry = !file.numRetry ? 1 : (file.numRetry += 1);
836
- scope.xhrLoad(file, url, type, onload, onerror);
837
+ setTimeout(() => {
838
+ file.numRetry = !file.numRetry ? 1 : (file.numRetry += 1);
839
+ scope.xhrLoad(file, url, type, onload, onerror);
840
+ }, 1000);
837
841
  return null;
838
842
  } else {
839
843
  return onerror.call(scope, file, xhr);
@@ -853,8 +857,10 @@ export class Loader {
853
857
  };
854
858
  xhr.onerror = () => {
855
859
  if (scope.isUseRetry && (!file.numRetry || file.numRetry < scope.maxRetry)) {
856
- file.numRetry = !file.numRetry ? 1 : (file.numRetry += 1);
857
- scope.xhrLoad(file, url, type, onload, onerror);
860
+ setTimeout(() => {
861
+ file.numRetry = !file.numRetry ? 1 : (file.numRetry += 1);
862
+ scope.xhrLoad(file, url, type, onload, onerror);
863
+ }, 1000);
858
864
  } else {
859
865
  try {
860
866
  return onerror.call(scope, file, xhr);
@@ -925,15 +931,12 @@ export class Loader {
925
931
  * @param {XMLHttpRequest} xhr - TBD.
926
932
  * @param {number} reason - TBD.
927
933
  */
928
- fileError(file, xhr, reason) {
934
+ fileError(file, xhr = null, reason = 0) {
929
935
  // const url = file.requestUrl || this.transformUrl(file.url, file);
930
- let message = 'Error loading asset';
931
936
  if (!reason && xhr) {
932
937
  reason = xhr.status;
933
938
  }
934
- if (reason || reason === 0) {
935
- message = message + ' (' + reason + ')';
936
- }
939
+ const message = 'Error loading asset (' + reason + ')';
937
940
  this.asyncComplete(file, message);
938
941
  }
939
942