@woosh/meep-engine 2.33.10 → 2.33.14

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.
@@ -52,17 +52,36 @@ WorkerBuilder.prototype.importScript = function (path) {
52
52
  this.imports.push(path);
53
53
  };
54
54
 
55
+ /**
56
+ *
57
+ * @param {string} code
58
+ * @return {string}
59
+ */
55
60
  function codeToURL(code) {
61
+ const js_mime = 'application/javascript';
62
+
56
63
  let blob;
57
- try {
58
- blob = new Blob([code], { type: 'application/javascript' });
59
- } catch (e) { // Backwards-compatibility
60
- window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;
61
- blob = new BlobBuilder();
62
- blob.append(code);
63
- blob = blob.getBlob();
64
+
65
+ if (typeof window === 'object') {
66
+ if (typeof window.Blob !== "undefined") {
67
+ blob = new Blob([code], { type: js_mime });
68
+ } else {
69
+ // Backwards-compatibility
70
+ const BlobBuilder = window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;
71
+ if (BlobBuilder !== undefined) {
72
+ blob = new BlobBuilder();
73
+ blob.append(code);
74
+ blob = blob.getBlob();
75
+ }
76
+ }
77
+ }
78
+
79
+ if (blob !== undefined && URL.createObjectURL !== undefined) {
80
+ return URL.createObjectURL(blob);
81
+ } else {
82
+ // build data URL in a slowest way possible
83
+ return `data:${js_mime},${encodeURIComponent(code)}`;
64
84
  }
65
- return URL.createObjectURL(blob);
66
85
  }
67
86
 
68
87
  /**
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "productName": "Meep",
5
5
  "description": "production-ready JavaScript game engine based on Entity Component System Architecture",
6
6
  "author": "Alexander Goldring",
7
- "version": "2.33.10",
7
+ "version": "2.33.14",
8
8
  "dependencies": {
9
9
  "fast-levenshtein": "2.0.6",
10
10
  "opentype.js": "1.3.3",