aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/shell.html10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/shell.html b/src/shell.html
index 284bc8d6..87c285ea 100644
--- a/src/shell.html
+++ b/src/shell.html
@@ -19,10 +19,14 @@
// connect to canvas
var Module = {
- canvas: document.getElementById('canvas'),
- ctx2D: document.getElementById('canvas').getContext('2d')
+ canvas: document.getElementById('canvas')
};
- if (!Module.ctx2D) alert('Canvas not available :(');
+ try {
+ Module.ctx2D = Module.canvas.getContext('2d');
+ if (!Module.ctx2D) throw 'Could not create canvas :(';
+ } catch (e) {
+ print('(canvas not available)');
+ }
// The compiled code
{{{ SCRIPT_CODE }}}