Documentation
Namespace

Namespace<T extends NameSpaceContent<keyof T>>

⚠️

This page is under construction.

⚠️

Beta feature, subject to change.

Namespace is a class that represents a namespace of a Storable

Public Properties

name

  • string - Human-readable name of the namespace

Public Methods

constructor

  • name: string - Human-readable name of the namespace
  • initContent: T - Initial content of the namespace
  • key?: string - The namespace key, default is the name

set<Key extends keyof T>

Example:

const namespace = new Namespace<{name: string}>('player1', {name: 'John Doe'});
 
namespace.set('name', 'Jane Smith');
  • key: Key - The key of the value to set
  • value: T[Key] - The value to set
  • Returns this

get<Key extends keyof T = any>

  • key: Key - The key of the value to get
  • Returns T[Key]