16 lines
693 B
JavaScript
16 lines
693 B
JavaScript
// Emscripten Module config, in an external file so it loads under a strict CSP
|
|
// (script-src 'self') without needing 'unsafe-inline'. Must load BEFORE
|
|
// vectorgons.js. The canvas (id="canvas") must already exist in the DOM.
|
|
var Module = {
|
|
canvas: (function () {
|
|
var c = document.getElementById('canvas');
|
|
c.addEventListener('click', function () { c.focus(); });
|
|
// Don't let arrow keys / space scroll the page while playing.
|
|
c.addEventListener('keydown', function (e) {
|
|
if ([32, 37, 38, 39, 40].indexOf(e.keyCode) >= 0) e.preventDefault();
|
|
});
|
|
return c;
|
|
})(),
|
|
print: function (t) { console.log(t); },
|
|
printErr: function (t) { console.error(t); }
|
|
};
|