Storage
The Storage class represents a store with actors, entities, components, and inputs.
Implements
Constructors
new Storage(storage, options)
new Storage(
storage,options):Storage
Constructs a new Storage object.
Parameters
• storage: Storage | StorageProps= {}
The properties of the store.
• options: StorageOptions= {}
Returns
Source
Properties
actors
actors:
string[]
The actors in the store.
Implementation of
Source
components
components:
Components
The components in the store.
Implementation of
Source
componentsIndex
componentsIndex:
ComponentsIndex<string,string>
The components index in the store.
Implementation of
StorageInterface.componentsIndex
Source
entities
entities:
string[]
The entities in the store.
Implementation of
Source
indexes
indexes:
Object
The indexes in the store.
Index signature
[key: string]: Object
Implementation of
Source
inputs
inputs:
Inputs
The inputs in the store.
Implementation of
Source
typeCtors
typeCtors:
Object
The type constructors in the store
Index signature
[key: string]: Function
Implementation of
Source
types
types:
Object
The types in the store.
Index signature
[key: string]: any
Implementation of
Source
Methods
destroyActor()
destroyActor(
id):boolean
Removes an actor ID.
Parameters
• id: string
The ID of the actor to remove.
Returns
boolean
True if the actor ID was removed, false otherwise.
Implementation of
Source
destroyComponent()
destroyComponent(
id,key):void
Removes a component.
Parameters
• id: string
The ID of the component to remove.
• key: string
The key of the component to remove.
Returns
void
Implementation of
StorageInterface.destroyComponent
Source
destroyEntity()
destroyEntity(
id):boolean
Removes an entity ID.
Parameters
• id: string
The ID of the entity to remove.
Returns
boolean
True if the entity ID was removed, false otherwise.
Implementation of
StorageInterface.destroyEntity
Source
destroyId()
destroyId(
list,id):boolean
Removes an ID from a list if it exists.
Parameters
• list: string[]
The list to remove the ID from.
• id: string
The ID to remove.
Returns
boolean
True if the ID was removed, false otherwise.
Implementation of
Source
findComponent()
findComponent(
id,key):any
Fetches a component.
Parameters
• id: string
The ID of the component to fetch.
• key: string
The key of the component to fetch.
Returns
any
The fetched component.
Implementation of
StorageInterface.findComponent
Source
findComponents()
findComponents(
id):Components
Fetches a components container for an entity.
Parameters
• id: string
The ID of the entity.
Returns
The fetched components container.
Implementation of
StorageInterface.findComponents
Source
findInput()
findInput(
id,index):InputPayload
Fetches an actors input
Parameters
• id: string
The ID of the actor.
• index: number
The index of the input.
Returns
The fetched inputs.
Implementation of
Source
findInputs()
findInputs(
id):InputPayload
Fetches an actors inputs
Parameters
• id: string
The ID of the actor.
Returns
The fetched inputs.
Implementation of
Source
getActors()
getActors():
string[]
Gets the actors.
Returns
string[]
The actors.
Implementation of
Source
getComponents()
getComponents():
Components
Gets the components.
Returns
The components.
Implementation of
StorageInterface.getComponents
Source
getEntities()
getEntities():
string[]
Gets the entities.
Returns
string[]
The entities.
Implementation of
Source
getInputs()
getInputs():
Inputs
Gets the inputs.
Returns
The inputs.
Implementation of
Source
isActor()
isActor(
id):boolean
Checks if an ID is an actor.
Parameters
• id: string
The ID to check.
Returns
boolean
True if the ID is an actor, false otherwise.
Implementation of
Source
isEntity()
isEntity(
id):boolean
Checks if an ID is an entity.
Parameters
• id: string
The ID to check.
Returns
boolean
True if the ID is an entity, false otherwise.
Implementation of
Source
listActors()
listActors(
query,pageSize):string[][]
Lists the actors.
Parameters
• query: any= null
The query to use.
• pageSize: number= Infinity
The page size to use.
Returns
string[][]
The actors.
Implementation of
Source
listComponents()
listComponents(
query,pageSize):Components[]
Lists the components.
Parameters
• query: any= null
The query to use.
• pageSize: number= Infinity
The page size to use.
Returns
The components.
Implementation of
StorageInterface.listComponents
Source
listEntities()
listEntities(
query,pageSize):string[][]
Lists the entities.
Parameters
• query: any= null
The query to use.
• pageSize: number= Infinity
The page size to use.
Returns
string[][]
The entities.
Implementation of
Source
listInputs()
listInputs(
query,pageSize):Inputs[]
Lists the inputs.
Parameters
• query: any= null
• pageSize: number= Infinity
Returns
Inputs[]
The inputs.
Implementation of
Source
queryComponents()
queryComponents(
query):Set<any>
Queries the store for entities by component.
Parameters
• query: any
The query to use.
Returns
Set<any>
The entities.
Implementation of
StorageInterface.queryComponents
Source
removeComponentsIndex()
removeComponentsIndex(
id,key,prevValue):void
Removes a component from the components index.
Parameters
• id: string
The ID of the component to remove.
• key: string
The key of the component to remove.
• prevValue: any
The previous value of the component.
Returns
void
Implementation of
StorageInterface.removeComponentsIndex
Source
setActors()
setActors(
actors):string[]
Sets the actors.
Parameters
• actors: string[]
The actors to set.
Returns
string[]
The actors.
Implementation of
Source
setComponents()
setComponents(
components):Components
Sets the components.
Parameters
• components: Components
The components to set.
Returns
The components.
Implementation of
StorageInterface.setComponents
Source
setEntities()
setEntities(
entities):string[]
Sets the entities.
Parameters
• entities: string[]
The entities to set.
Returns
string[]
The entities.
Implementation of
Source
setInputs()
setInputs(
inputs):Inputs
Sets the inputs.
Parameters
• inputs: Inputs
The inputs to set.
Returns
The inputs.
Implementation of
Source
storeActor()
storeActor(
id):boolean
Stores an actor ID.
Parameters
• id: string
The ID of the actor to store.
Returns
boolean
True if the actor ID was stored, false otherwise.
Implementation of
Source
storeComponent()
storeComponent(
id,key,value):void
Stores a component.
Parameters
• id: string
The ID of the component to store.
• key: string
The key of the component to store.
• value: any
The value of the component to store.
Returns
void
Implementation of
StorageInterface.storeComponent
Source
storeEntity()
storeEntity(
id):boolean
Stores an entity ID.
Parameters
• id: string
The ID of the entity to store.
Returns
boolean
True if the entity ID was stored, false otherwise.
Implementation of
Source
storeId()
storeId(
list,id):boolean
Stores an ID in a list if it doesn’t exist already.
Parameters
• list: string[]
The list to store the ID in.
• id: string
The ID to store.
Returns
boolean
True if the ID was stored, false otherwise.
Implementation of
Source
storeInput()
storeInput(
id,input,tick):number
Stores an input.
Parameters
• id: string
The ID of the input to store.
• input: InputPayload
The payload of the input to store.
• tick: number= 0
Returns
number
The new index of the stored input.
Implementation of
Source
updateComponentsIndex()
updateComponentsIndex(
id,key,prevValue,value):void
Updates a component in the components index.
Parameters
• id: string
The ID of the component to update.
• key: string
The key of the component to update.
• prevValue: any
The previous value of the component.
• value: any
The new value of the component.
Returns
void
Implementation of
StorageInterface.updateComponentsIndex
Source
Generated using typedoc-plugin-markdown and TypeDoc