diff options
Diffstat (limited to 'src/shell.html')
-rw-r--r-- | src/shell.html | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/shell.html b/src/shell.html index 226f12b9..d204bfa6 100644 --- a/src/shell.html +++ b/src/shell.html @@ -1245,7 +1245,16 @@ console.error(text); } }, - canvas: document.getElementById('canvas'), + canvas: (function() { + var canvas = document.getElementById('canvas'); + + // As a default initial behavior, pop up an alert when webgl context is lost. To make your + // application robust, you may want to override this behavior before shipping! + // See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2 + canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false); + + return canvas; + })(), setStatus: function(text) { if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' }; if (text === Module.setStatus.text) return; @@ -1273,6 +1282,13 @@ } }; Module.setStatus('Downloading...'); + window.onerror = function() { + Module.setStatus('Exception thrown, see JavaScript console'); + spinnerElement.style.display = 'none'; + Module.setStatus = function(text) { + if (text) Module.printErr('[post-exception status] ' + text); + }; + }; </script> {{{ SCRIPT }}} </body> |