Skip to content

webmuds/core-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@webmuds/core-js

build Total alerts Language grade: JavaScript

Core objects for WebMUDs Javascript projects.

Classes

Runtime

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.

Resource

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

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.

Collection

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.

Logger

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.

License

MIT