Documentation Index
Fetch the complete documentation index at: https://mintlify.com/xXmizzeryXx/zenodeployment/llms.txt
Use this file to discover all available pages before exploring further.
zeno-game-sw.js is the core of Zeno’s game serving layer. It maintains a single fileStore Map keyed by full pathname — /zeno-games/{gameId}/{relPath} — and intercepts every fetch request that targets that prefix, responding with the appropriate file buffer and MIME type directly from memory. No network requests are made for registered games.
Install and activate lifecycle
The SW installs and takes control immediately without waiting for existing tabs to close.skipWaiting() forces the new SW version to activate as soon as it finishes installing. clients.claim() makes the active SW take control of all open clients on the same origin immediately, ensuring games registered before a SW update are still served correctly.
Message protocol
The page communicates with the SW viapostMessage. All messages use the shape { type, payload }. Responses that require a reply are sent back over a MessageChannel port passed as event.ports[0].
REGISTER_GAME
REGISTER_GAME
Transfers all file buffers for a game into the SW’s in-memory store.Payload:
Response:
| Field | Type | Description |
|---|---|---|
gameId | string | Unique identifier for the game |
filesMeta | { path: string, mimeType: string }[] | Metadata for each file, parallel-indexed with buffers |
buffers | ArrayBuffer[] | Raw file contents, one per entry in filesMeta |
{ type: 'GAME_REGISTERED', gameId }Zeno always clones buffers with
.slice(0) before transfer so the originals
in fileRecords remain intact and can be re-sent after an SW restart.PING_GAME
PING_GAME
Checks whether at least one file for a given game is still present in the store.Payload:
Response:
| Field | Type | Description |
|---|---|---|
gameId | string | The game to check |
{ type: 'GAME_FOUND', gameId } or { type: 'GAME_MISSING', gameId }The SW checks for any key with the prefix /zeno-games/{gameId}/. A GAME_MISSING response is the signal that the SW was restarted and the game must be re-registered before launching.UNREGISTER_GAME
UNREGISTER_GAME
Removes all files for a single game from the store. Used when deleting a game from the library.Payload:
Response: None.
| Field | Type | Description |
|---|---|---|
gameId | string | The game whose files should be removed |
CLEAR_ALL
CLEAR_ALL
Wipes the entire
fileStore Map. Useful for a full reset.Payload: None.Response: None.Fetch handler
When a request URL contains/zeno-games/, the SW intercepts it and normalizes the pathname to prevent directory traversal (.. segments are resolved). It then looks up the normalized path in fileStore.
- Match found — responds with the stored
ArrayBuffer, the registeredmimeType,Cache-Control: no-store, andAccess-Control-Allow-Origin: *. - No match, SPA fallback — strips the final path segment and tries
index.htmlin the same directory, responding withtext/html. - No match at all — responds with a plain-text
404body and HTTP status 404.
/zeno-games/my-game/level/2 would not have a physical file) still load correctly.
Why the store resets
ThefileStore Map lives entirely in the SW’s JavaScript heap. Browsers routinely terminate idle service workers to reclaim memory — when this happens, the Map is gone. Zeno’s PING → re-register pattern handles this transparently:
- Before opening a game iframe, the page sends
PING_GAME. - If the response is
GAME_MISSING, the page re-reads the files from itsfileRecordsarray and sendsREGISTER_GAMEagain. - Only after receiving
GAME_REGISTEREDdoes the page load the iframe.