mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-22 00:15:46 -07:00
js: Add a trivial error handler that alert()s
I'm not quite sure how useful it will be, but it does at least catch an assertion failure in main() and present an opaque message in a box, which is better than stopping and putting a message in the console where no-one will see it.
This commit is contained in:
@ -19,6 +19,12 @@
|
|||||||
// immediately. On the other hand, the Emscripten runtime hasn't
|
// immediately. On the other hand, the Emscripten runtime hasn't
|
||||||
// started yet, so Module.cwrap isn't safe.
|
// started yet, so Module.cwrap isn't safe.
|
||||||
|
|
||||||
|
// Error handler to make any failures from here on visible to the
|
||||||
|
// user, maybe.
|
||||||
|
window.addEventListener("error", function (e) {
|
||||||
|
alert(e.message);
|
||||||
|
});
|
||||||
|
|
||||||
// To avoid flicker while doing complicated drawing, we use two
|
// To avoid flicker while doing complicated drawing, we use two
|
||||||
// canvases, the same size. One is actually on the web page, and the
|
// canvases, the same size. One is actually on the web page, and the
|
||||||
// other is off-screen. We do all our drawing on the off-screen one
|
// other is off-screen. We do all our drawing on the off-screen one
|
||||||
|
Reference in New Issue
Block a user