From a82f70ea9f98ed0a602a20f7fe8954f6e4200b25 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Thu, 19 Nov 2020 16:54:07 +0100 Subject: [HTML5] Libraries refactor for linting. Initial work to make liniting easier. This includes: - Rename http_request.js to library_godot_http_request.js. - Rename externs.js to engine.externs.js. - New library_godot_runtime.js (GodotRuntime) wraps around emscripten functions. - Refactor of XMLHttpRequest handler in engine/preloader.js. - Few fixes to bugs spotted by early stage linting. --- platform/javascript/engine/utils.js | 51 ------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 platform/javascript/engine/utils.js (limited to 'platform/javascript/engine/utils.js') diff --git a/platform/javascript/engine/utils.js b/platform/javascript/engine/utils.js deleted file mode 100644 index 8455739a25..0000000000 --- a/platform/javascript/engine/utils.js +++ /dev/null @@ -1,51 +0,0 @@ -var Utils = { - 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('.wasm')) { - return execName + '.wasm'; - } - } - return rw; - }, - - createInstantiatePromise: function(wasmLoader) { - function instantiateWasm(imports, onSuccess) { - wasmLoader.then(function(xhr) { - WebAssembly.instantiate(xhr.response, imports).then(function(result) { - onSuccess(result['instance'], result['module']); - }); - }); - wasmLoader = null; - return {}; - }; - - return instantiateWasm; - }, - - findCanvas: function() { - var nodes = document.getElementsByTagName('canvas'); - if (nodes.length && nodes[0] instanceof HTMLCanvasElement) { - return nodes[0]; - } - throw new Error("No canvas found"); - }, - - isWebGLAvailable: function(majorVersion = 1) { - var testContext = false; - try { - var 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) {} - return !!testContext; - } -}; -- cgit v1.2.3