konami-kickass
v1.0.0
Published
Listen for the Konami code, then unleash the KickAss game overlay on any page.
Downloads
33
Maintainers
Readme
konami-kickass
Listen for the Konami code
(↑ ↑ ↓ ↓ ← → ← → B A) and, once entered, unleash the
KickAss game overlay on any page.
Install
npm install konami-kickassUsage
import { listenForKonami } from "konami-kickass";
// Start listening. Enter the Konami code to launch KickAss.
listenForKonami();With options:
import { listenForKonami } from "konami-kickass";
const listener = listenForKonami({
repeat: true, // keep listening after activation
onActivate() {
console.log("KickAss launched!");
},
});
// Later, stop listening:
listener.destroy();You can also trigger it manually:
import { launchKickass } from "konami-kickass";
launchKickass();Script tag
If you are not using a bundler, build then drop the ESM bundle into a module script:
<script type="module">
import { listenForKonami } from "./dist/konami-kickass.js";
listenForKonami();
</script>Demo
A standalone page lives in examples/demo/:
npm run demo # builds, then serves on http://localhost:8899Open http://localhost:8899/examples/demo/ and type the Konami code. An
on-screen meter tracks progress; entering the full sequence launches the game.
Uncomment the assetBase line in the demo to test a proxy.
API
listenForKonami(options?)
Attaches a keydown listener and calls launchKickass() once the sequence is
entered. Returns a { destroy() } handle.
| Option | Type | Default | Description |
| ------------ | ------------------------ | -------------------------- | -------------------------------------------------- |
| target | Window \| HTMLElement | window | Element to attach the listener to. |
| sequence | string[] | Konami code | Custom key sequence (KeyboardEvent.key values). |
| repeat | boolean | false | Keep listening after the first activation. |
| assetBase | string | https://kickassapp.com/ | Proxy base for KickAss's own runtime assets. |
| onActivate | () => void | — | Called right after KickAss launches. |
launchKickass(assetBase?)
Injects the bundled KickAss source into the page inline (no remote script
fetch). Safe to call in non-DOM environments (no-op) and only injects once.
Pass assetBase to proxy KickAss's runtime requests (see below).
Proxying KickAss's runtime requests
Bundling the script removes the fetch of kickass.js itself, but KickAss still
loads its own assets at runtime — CSS, sprites, sounds, api.json, and
postMessage iframes — all from a single base URL (https://kickassapp.com/).
That base is configurable. Point it at your own proxy:
import { listenForKonami } from "konami-kickass";
listenForKonami({
assetBase: "https://your-proxy.example/kickass/",
});or directly:
import { launchKickass } from "konami-kickass";
launchKickass("https://your-proxy.example/kickass/");Your proxy must forward requests to https://kickassapp.com/ and preserve
paths (e.g. /css/menustyles.css, /static/sounds/game/shot.mp3,
/mysite/api.json, /hello.html). Notes:
- The base must end with a trailing slash.
- Iframe messaging uses this base as its
postMessageorigin, so the proxy origin must servehello.html/intermediate_postmessage.htmlfor the socket features to work. - To fully self-host, mirror the
kickassapp.comasset tree behind your proxy.
Ready-made proxies (Cloudflare Worker + Express) live in
examples/proxy/ — deploy one and use its URL as
assetBase.
How it works
It reproduces this bookmarklet, gated behind the Konami code — except the
KickAss source is vendored into the package (src/kickass.vendor.js) and
injected inline instead of loaded from a remote URL:
var KICKASSVERSION = "2.0";
var s = document.createElement("script");
s.type = "text/javascript";
s.text = /* bundled kickass.js source */;
document.body.appendChild(s);Note: KickAss itself still makes its own network requests at runtime — see Proxying KickAss's runtime requests to route those. To refresh the vendored copy, replace
src/kickass.vendor.jsand rebuild.
License
MIT
