mirror of
https://github.com/godotengine/godot.git
synced 2025-10-23 18:03:35 +00:00
[HTML5] Run eslint --fix.
Should I write a poem about this whole new world? ;)
This commit is contained in:
parent
0813008b8a
commit
f316a1719d
13 changed files with 518 additions and 510 deletions
|
@ -1,49 +1,48 @@
|
|||
var Utils = { // eslint-disable-line no-unused-vars
|
||||
const Utils = { // eslint-disable-line no-unused-vars
|
||||
|
||||
createLocateRewrite: function(execName) {
|
||||
createLocateRewrite: function (execName) {
|
||||
function rw(path) {
|
||||
if (path.endsWith('.worker.js')) {
|
||||
return execName + '.worker.js';
|
||||
return `${execName}.worker.js`;
|
||||
} else if (path.endsWith('.audio.worklet.js')) {
|
||||
return execName + '.audio.worklet.js';
|
||||
return `${execName}.audio.worklet.js`;
|
||||
} else if (path.endsWith('.js')) {
|
||||
return execName + '.js';
|
||||
return `${execName}.js`;
|
||||
} else if (path.endsWith('.wasm')) {
|
||||
return execName + '.wasm';
|
||||
return `${execName}.wasm`;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
return rw;
|
||||
},
|
||||
|
||||
createInstantiatePromise: function(wasmLoader) {
|
||||
createInstantiatePromise: function (wasmLoader) {
|
||||
let loader = wasmLoader;
|
||||
function instantiateWasm(imports, onSuccess) {
|
||||
loader.then(function(xhr) {
|
||||
WebAssembly.instantiate(xhr.response, imports).then(function(result) {
|
||||
loader.then(function (xhr) {
|
||||
WebAssembly.instantiate(xhr.response, imports).then(function (result) {
|
||||
onSuccess(result['instance'], result['module']);
|
||||
});
|
||||
});
|
||||
loader = null;
|
||||
return {};
|
||||
};
|
||||
}
|
||||
|
||||
return instantiateWasm;
|
||||
},
|
||||
|
||||
findCanvas: function() {
|
||||
var nodes = document.getElementsByTagName('canvas');
|
||||
findCanvas: function () {
|
||||
const nodes = document.getElementsByTagName('canvas');
|
||||
if (nodes.length && nodes[0] instanceof HTMLCanvasElement) {
|
||||
return nodes[0];
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
isWebGLAvailable: function(majorVersion = 1) {
|
||||
|
||||
var testContext = false;
|
||||
isWebGLAvailable: function (majorVersion = 1) {
|
||||
let testContext = false;
|
||||
try {
|
||||
var testCanvas = document.createElement('canvas');
|
||||
const testCanvas = document.createElement('canvas');
|
||||
if (majorVersion === 1) {
|
||||
testContext = testCanvas.getContext('webgl') || testCanvas.getContext('experimental-webgl');
|
||||
} else if (majorVersion === 2) {
|
||||
|
@ -53,5 +52,5 @@ var Utils = { // eslint-disable-line no-unused-vars
|
|||
// Not available
|
||||
}
|
||||
return !!testContext;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue