npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

wasm-doom

v1.2.0

Published

A typescript renderer module for running DOOM as WebAssembly in the browser

Readme

DOOM WASM Renderer

A typescript renderer module for running DOOM as WebAssembly in the browser.

Load the game and render it however you want — to Canvas, DOM elements, or any custom implementation.

Includes built-in keyboard handling and optional logging.

Based on the awesome WebAssembly from Scratch: From FizzBuzz to DooM project.

Installation

bun add -D wasm-doom
# or
npm install -D wasm-doom
# or
yarn add -D wasm-doom

Usage

Canvas Rendering

The most performant way to render DOOM using the Canvas API:

import { DOOM } from 'wasm-doom';

const screenWidth = 640;
const screenHeight = 400;

const canvas = document.getElementById('game');
const ctx = canvas.getContext('2d');
canvas.width = screenWidth;
canvas.height = screenHeight;

const game = new DOOM({
  screenWidth,
  screenHeight,
  enableLogs: true,
  onFrameRender: ({ screen }) => {
    const frame = new ImageData(screen, screenWidth, screenHeight);
    ctx.putImageData(frame, 0, 0);
  },
});

await game.start();

Pixel-by-Pixel Rendering

For custom rendering implementations where you need individual pixel control:

import { DOOM } from 'wasm-doom';

const game = new DOOM({
  screenWidth: 320,
  screenHeight: 200,
  onPixelRender: ({ x, y, r, g, b, a }) => {
    // Your custom pixel rendering logic
    const pixel = getPixelAt(x, y);
    pixel.changeColor(`rgba(${r}, ${g}, ${b}, ${a})`);
  },
});

await game.start();

API

Constructor Options

new DOOM({
  screenWidth: number;              // Width of the output screen in pixels
  screenHeight: number;             // Height of the output screen in pixels
  wasmURL?: string;                 // Optional custom URL to DOOM WASM binary (default: https://cdn.jsdelivr.net/npm/wasm-doom/wasm/doom.wasm)
  keyboardTarget?: HTMLElement;     // Optional target element for keyboard events
  enableLogs?: boolean;             // Enable WASM console output (default: false)
  onPixelRender?: (event) => void;  // Per-pixel render callback
  onFrameRender?: (event) => void;  // Per-frame render callback
})

Render Callbacks

onPixelRender: Called for each pixel during rendering

{
  x: number; // X coordinate (0 to screenWidth-1)
  y: number; // Y coordinate (0 to screenHeight-1)
  r: number; // Red component (0-255)
  g: number; // Green component (0-255)
  b: number; // Blue component (0-255)
  a: number; // Alpha component (0-255)
}

onFrameRender: Called once per frame with complete screen buffer

{
  screen: Uint8ClampedArray; // RGBA pixel data (width * height * 4 bytes)
}

Methods

start(): Initializes and starts the game loop

await game.start();

Examples

See the example directory for working demonstrations:

  • canvas.html — Canvas rendering
  • divs.html — DOM-based pixel-by-pixel rendering
  • tiling.html — DOM rendering using tiling technique

Run examples locally:

bun run dev

Credits

License

DOOM is originally created by id Software and released under the GNU General Public License v2.0.

The WebAssembly port maintains the same GPL-2.0 license from the original DOOM source code.