Core objects for WebMUDs Javascript projects.
The base Runtime class. Runtime classes are responsible for game logic around a certain resource. E.g., Mud runtimes handle mud-wide logic, Character runtimes handle character-only logic, etc.
Resources are objects that represent API records. Each Resource points to an API endpoint, and data can be downloaded and updated.
Events:
downloaded (resource, data, duration)
patched (resource, data, duration)
error (error, resource)
Payload instances are minimal JSON-friendly objects that store data and can be transferred over channels (including Websocket connections). Payload classes map shorthand property names to their full names from the API. Payload instances are used internally by Resource instances to store data.
A Collection is an opinionated Map
extension that only adds objects that have an id
property. Those collections are extensively used across the codebase to standardize object lookup by ID.
This is just a wrapper class around console.log
to make it easier to replace in the future if needed. A global instance is offered in config/logger.js
that can be imported by other classes.
MIT