Observed since 20 Oct, 19:58 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A lightweight 404-page game library with JavaScript, Web Component, and React APIs.
A small runner game for 404 pages, available as a framework-independent JavaScript API, a Web Component, or a thin React component.
npm install 404-games
404-games is the intended package name. npm publication is pending, and the name may
change before release.
The package is ESM-only and includes TypeScript declarations. The examples below assume
an ESM-aware app/bundler, such as Vite. React 19 is required only for 404-games/react;
the base API and Web Component do not require React.
Add a container to your page:
<div id="game" style="max-width: 900px"></div>
Run this after the container exists:
import {create404Game} from '404-games';
const container = document.getElementById('game');
if (!container) throw new Error('Game container not found');
const game = create404Game({
container,
accentColor: '#ff0000',
});
The game starts automatically. Keep the returned controller to manage its lifecycle:
game.pause();
game.resume();
game.restart();
// When the game is no longer needed:
game.destroy();
<error-404-game accent-color="#414141"></error-404-game>
Register explicitly in your app's browser entry:
import {
registerError404Game,
type Error404GameElement,
} from '404-games/web-component';
registerError404Game();
const game = document.querySelector<Error404GameElement>('error-404-game');
game?.pause();
game?.resume();
game?.restart();
Importing the entry does not register the element. Registration is safe to repeat. Connection automatically creates a game; removal destroys it; reconnection creates a fresh game. There is no Shadow DOM.
Changing accent-color while connected recreates the game and starts a fresh run.
Removing the attribute restores the library default. Changes while disconnected take
effect on the next connection. Empty or blank values are rejected.
The element has no destroy() method: remove it from the DOM to clean up.
import {useRef} from 'react';
import {Error404Game, type Error404GameHandle} from '404-games/react';
export function Game() {
const gameRef = useRef<Error404GameHandle>(null);
return (
<section>
<Error404Game
ref={gameRef}
accentColor="#414141"
className="game"
style={{maxWidth: 900}}
/>
<button onClick={() => gameRef.current?.pause()}>Pause</button>
<button onClick={() => gameRef.current?.resume()}>Resume</button>
<button onClick={() => gameRef.current?.restart()}>Restart</button>
</section>
);
}
The component owns its container and cleans up on unmount. Changing accentColor
destroys the previous game and creates a fresh one; omitting it uses the library default.
React Strict Mode is supported. The ref exposes controls only, with no destroy() method.
create404Game(options): GameControllerExported from 404-games, along with the GameOptions and GameController types.
Creates and attaches a canvas to the supplied container, starts the game, and returns
its controller. The caller owns the container; the library owns and removes its canvas.
type GameOptions = {
container: HTMLElement;
accentColor?: string;
};
type GameController = {
pause(): void;
resume(): void;
restart(): void;
destroy(): void;
};
container must be a real HTMLElement. accentColor is optional; an empty or blank
value throws. Omit it to use the library default.
| Method | Behavior |
|---|---|
pause() | Manually pauses the game. Switching tabs does not clear a manual pause. |
resume() | Resumes a manually paused game. |
restart() | Resets the run and resumes it. |
destroy() | Permanently ends the instance, cleans up owned resources, and removes its canvas. |
Repeated destruction and lifecycle calls after destruction are safe no-ops.
404-games/web-component exports Error404GameElement and registerError404Game().
| Attribute / method | Behavior |
|---|---|
accent-color | Optional; maps directly to accentColor. A changed value recreates the connected game. |
pause() | Pauses the active game. |
resume() | Resumes the active game. |
restart() | Resets and resumes the active game. |
Control calls safely do nothing when no game exists. DOM removal owns destruction.
404-games/react exports Error404Game, Error404GameProps, and Error404GameHandle.
import type {CSSProperties} from 'react';
type Error404GameProps = {
accentColor?: string;
className?: string;
style?: CSSProperties;
};
type Error404GameHandle = {
pause(): void;
resume(): void;
restart(): void;
};
className and style apply to the wrapper div. Styling changes do not recreate the
game. Arbitrary DOM props are not forwarded. Handle methods target the current game
and safely do nothing when no active game exists.
Sprites and audio ship with the package. Your app's bundler resolves and emits them automatically, including when the app is served below the site root. Do not copy assets into a public folder or supply manual asset paths. No asset-path configuration is needed.
Designed for modern browsers with Canvas 2D, Pointer Events, ResizeObserver, and Web Components when using the custom element. Gameplay runs in the browser; import and register the Web Component in a browser environment.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.0Registry latest | 16 Oct 2026 | 8 | |
| 0.0.0-stage | 16 Oct 2026 | 0 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 19:58 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:6468c8733e7bf31755aa0a4a2f00e90b0d8341609a248ebd17544ada5a895a35