Hacker News new | ask | show | jobs
by mdaniel 1775 days ago
As a counter-point to this, `document.write` is (currently) a render blocking action, and thus allows one to load assets without a bunch of `document.addEventListener("DOMContentReady", (ohgawd) => {})` business to ensure a `window.__whatever__` is initialized before 10 quadrillion megs of JS run

Maybe in some pseudofuture there will be a less heinous way to schedule the order of JS evaluation, but until that future materializes, document.write is damn handy

1 comments

...and window.alert is a blocking action, which allows you to display a message like "You lost! Your score: 1234 points" without having to build additional UI or adapt the loop of your game to be able to prevent game logic from continuing until the user clicks "ok" - which for jam games is damn handy ;)