Skip to content

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

Storage

Source

ecmascript/src/storage.ts:224

Properties

actors

actors: string[]

The actors in the store.

Implementation of

StorageInterface.actors

Source

ecmascript/src/storage.ts:205


components

components: Components

The components in the store.

Implementation of

StorageInterface.components

Source

ecmascript/src/storage.ts:207


componentsIndex

componentsIndex: ComponentsIndex<string, string>

The components index in the store.

Implementation of

StorageInterface.componentsIndex

Source

ecmascript/src/storage.ts:214


entities

entities: string[]

The entities in the store.

Implementation of

StorageInterface.entities

Source

ecmascript/src/storage.ts:206


indexes

indexes: Object

The indexes in the store.

Index signature

[key: string]: Object

Implementation of

StorageInterface.indexes

Source

ecmascript/src/storage.ts:215


inputs

inputs: Inputs

The inputs in the store.

Implementation of

StorageInterface.inputs

Source

ecmascript/src/storage.ts:209


typeCtors

typeCtors: Object

The type constructors in the store

Index signature

[key: string]: Function

Implementation of

StorageInterface.typeCtors

Source

ecmascript/src/storage.ts:212


types

types: Object

The types in the store.

Index signature

[key: string]: any

Implementation of

StorageInterface.types

Source

ecmascript/src/storage.ts:211

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

StorageInterface.destroyActor

Source

ecmascript/src/storage.ts:234


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

ecmascript/src/storage.ts:245


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

ecmascript/src/storage.ts:257


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

StorageInterface.destroyId

Source

ecmascript/src/storage.ts:269


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

ecmascript/src/storage.ts:296


findComponents()

findComponents(id): Components

Fetches a components container for an entity.

Parameters

id: string

The ID of the entity.

Returns

Components

The fetched components container.

Implementation of

StorageInterface.findComponents

Source

ecmascript/src/storage.ts:284


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

InputPayload

The fetched inputs.

Implementation of

StorageInterface.findInput

Source

ecmascript/src/storage.ts:318


findInputs()

findInputs(id): InputPayload

Fetches an actors inputs

Parameters

id: string

The ID of the actor.

Returns

InputPayload

The fetched inputs.

Implementation of

StorageInterface.findInputs

Source

ecmascript/src/storage.ts:307


getActors()

getActors(): string[]

Gets the actors.

Returns

string[]

The actors.

Implementation of

StorageInterface.getActors

Source

ecmascript/src/storage.ts:332


getComponents()

getComponents(): Components

Gets the components.

Returns

Components

The components.

Implementation of

StorageInterface.getComponents

Source

ecmascript/src/storage.ts:341


getEntities()

getEntities(): string[]

Gets the entities.

Returns

string[]

The entities.

Implementation of

StorageInterface.getEntities

Source

ecmascript/src/storage.ts:350


getInputs()

getInputs(): Inputs

Gets the inputs.

Returns

Inputs

The inputs.

Implementation of

StorageInterface.getInputs

Source

ecmascript/src/storage.ts:359


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

StorageInterface.isActor

Source

ecmascript/src/storage.ts:369


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

StorageInterface.isEntity

Source

ecmascript/src/storage.ts:380


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

StorageInterface.listActors

Source

ecmascript/src/storage.ts:392


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

Components[]

The components.

Implementation of

StorageInterface.listComponents

Source

ecmascript/src/storage.ts:417


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

StorageInterface.listEntities

Source

ecmascript/src/storage.ts:444


listInputs()

listInputs(query, pageSize): Inputs[]

Lists the inputs.

Parameters

query: any= null

pageSize: number= Infinity

Returns

Inputs[]

The inputs.

Implementation of

StorageInterface.listInputs

Source

ecmascript/src/storage.ts:467


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

ecmascript/src/storage.ts:611


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

ecmascript/src/storage.ts:623


setActors()

setActors(actors): string[]

Sets the actors.

Parameters

actors: string[]

The actors to set.

Returns

string[]

The actors.

Implementation of

StorageInterface.setActors

Source

ecmascript/src/storage.ts:493


setComponents()

setComponents(components): Components

Sets the components.

Parameters

components: Components

The components to set.

Returns

Components

The components.

Implementation of

StorageInterface.setComponents

Source

ecmascript/src/storage.ts:504


setEntities()

setEntities(entities): string[]

Sets the entities.

Parameters

entities: string[]

The entities to set.

Returns

string[]

The entities.

Implementation of

StorageInterface.setEntities

Source

ecmascript/src/storage.ts:515


setInputs()

setInputs(inputs): Inputs

Sets the inputs.

Parameters

inputs: Inputs

The inputs to set.

Returns

Inputs

The inputs.

Implementation of

StorageInterface.setInputs

Source

ecmascript/src/storage.ts:526


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

StorageInterface.storeActor

Source

ecmascript/src/storage.ts:537


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

ecmascript/src/storage.ts:549


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

StorageInterface.storeEntity

Source

ecmascript/src/storage.ts:561


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

StorageInterface.storeId

Source

ecmascript/src/storage.ts:573


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

StorageInterface.storeInput

Source

ecmascript/src/storage.ts:589


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

ecmascript/src/storage.ts:644


Generated using typedoc-plugin-markdown and TypeDoc