diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-02-26 15:31:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-26 15:31:44 +0100 |
commit | 75d03f1fbd94efb5f8756e405de03cf271435336 (patch) | |
tree | 8b9c29410fafdd55c67fc54acb21522a0e957bb8 /platform/javascript/js/engine/utils.js | |
parent | 40a70f1657dc9107666b78b58e97e8615ea7f3ff (diff) | |
parent | 472482013e760b0c0334d99b7bf21d9bd2a3a206 (diff) | |
download | redot-engine-75d03f1fbd94efb5f8756e405de03cf271435336.tar.gz |
Merge pull request #46446 from Faless/js/4.x_jsdoc
[HTML5] Document Engine and EngineConfig (jsdoc).
Diffstat (limited to 'platform/javascript/js/engine/utils.js')
-rw-r--r-- | platform/javascript/js/engine/utils.js | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/platform/javascript/js/engine/utils.js b/platform/javascript/js/engine/utils.js deleted file mode 100644 index 9273bbad42..0000000000 --- a/platform/javascript/js/engine/utils.js +++ /dev/null @@ -1,58 +0,0 @@ -const Utils = { // eslint-disable-line no-unused-vars - - createLocateRewrite: function (execName) { - function rw(path) { - if (path.endsWith('.worker.js')) { - return `${execName}.worker.js`; - } else if (path.endsWith('.audio.worklet.js')) { - return `${execName}.audio.worklet.js`; - } else if (path.endsWith('.js')) { - return `${execName}.js`; - } else if (path.endsWith('.side.wasm')) { - return `${execName}.side.wasm`; - } else if (path.endsWith('.wasm')) { - return `${execName}.wasm`; - } - return path; - } - return rw; - }, - - createInstantiatePromise: function (wasmLoader) { - let loader = wasmLoader; - function instantiateWasm(imports, onSuccess) { - loader.then(function (xhr) { - WebAssembly.instantiate(xhr.response, imports).then(function (result) { - onSuccess(result['instance'], result['module']); - }); - }); - loader = null; - return {}; - } - - return instantiateWasm; - }, - - findCanvas: function () { - const nodes = document.getElementsByTagName('canvas'); - if (nodes.length && nodes[0] instanceof HTMLCanvasElement) { - return nodes[0]; - } - return null; - }, - - isWebGLAvailable: function (majorVersion = 1) { - let testContext = false; - try { - const testCanvas = document.createElement('canvas'); - if (majorVersion === 1) { - testContext = testCanvas.getContext('webgl') || testCanvas.getContext('experimental-webgl'); - } else if (majorVersion === 2) { - testContext = testCanvas.getContext('webgl2') || testCanvas.getContext('experimental-webgl2'); - } - } catch (e) { - // Not available - } - return !!testContext; - }, -}; |