Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(+1)

Here, look at the source code for RogueBot (it's the old version of the framework, which has a bug, but that's elsewhere). In the resize() method of each screen I simply store the width and height (probably overkill) and precalculate some values (this was before I started using whole-canvas scaling systematically). Note how I use innerWidth/innerHeight, because it's supported by every browser that matters, and only re-read them in a resize event handler, because there's no point otherwise. And yes, the browser fires several of those while a window resizes; that's true both on the desktop and mobile, e.g. when playing with the responsive view in Firefox or rotating the device. But it's still better than checking it all the time.