I think you'll want to add the following line after instantiating the context:
context.canvas.style.maxWidth = '100%';
Otherwise many people won't see the full canvas. :)
Please also note that DOM.context2d() will upscale the canvas' internal resolution depending on devicePixelRatio. On many HiDPI/Retina displays you'll get a resolution of 3840x2160 (or larger). To avoid this, set the desired dpr explicitely (note the last argument):
const context = DOM.context2d(W, H, 1);