Context
The Context class provides methods for managing the context.
Constructors
new Context(context, options, _Storage)
new Context(
context
,options
,_Storage
):Context
Creates a new instance of the Context class.
Parameters
• context: Context
| ContextProps
= {}
The context properties.
• options: any
The context options.
• _Storage: typeof Storage
= Storage
The store.
Returns
Source
Properties
changes
changes:
null
|Changes
The changes.
Source
events
events:
any
The events.
Source
order
order:
null
|Ordered
The order.
Source
pending
pending:
null
|Pending
The pending.
Source
store
store:
StorageInterface
The store.
Source
symbols
symbols:
null
|Symbols
Source
Accessors
actors
get
actors():any
Gets the actors from the store.
Returns
any
The actors from the store.
Source
components
get
components():any
Gets the components from the store.
Returns
any
The components from the store.
Source
entities
get
entities():any
Gets the entities from the store.
Returns
any
The entities from the store.
Source
inputs
get
inputs():any
Gets the inputs from the store.
Returns
any
The inputs from the store.
Source
symbolsEnum
get
symbolsEnum():undefined
|Enum
Gets the enum of symbols.
Returns
undefined
| Enum
The enum of symbols.
Source
symbolsList
get
symbolsList():undefined
|string
[]
Gets the list of symbols.
Returns
undefined
| string
[]
The list of symbols.
Source
Methods
actorInput()
actorInput(
id
,input
,tick
,options
):number
|Promise
<number
>
Handles actor input with the given id, payload, and options.
Parameters
• id: string
The id of the actor.
• input: InputPayload
The payload for the actor input.
• tick: number
= 0
The tick value for the actor input. Defaults to 0.
• options: Options
The options for handling the actor input.
Returns
number
| Promise
<number
>
Source
addSymbol()
addSymbol(
symbol
,options
):null
|number
Adds a symbol with the given symbol and options.
Parameters
• symbol: string
The symbol to add.
• options: Options
The options for adding the symbol.
Returns
null
| number
The index of the added symbol or null if the symbol could not be added.
Source
changeComponent()
changeComponent(
id
,key
,value
,tick
,options
):any
Changes a component with the given id, key, value, and options.
Parameters
• id: string
| Uint32Array
| string
[]
The id of the component to change.
• key: string
The key of the component to change.
• value: any
The value to change in the component.
• tick: number
= 0
The tick value for the component. Defaults to 0.
• options: Options
The options for changing the component.
Returns
any
Source
createEntity()
createEntity(
id
,options
):boolean
|Promise
<boolean
>
Creates an entity with the given id and options.
Parameters
• id: string
The id of the entity to create.
• options: Options
The options for creating the entity.
Returns
boolean
| Promise
<boolean
>
Source
fetchSymbol()
fetchSymbol(
payload
,options
,onMatch
):null
| [string
,number
]
Fetches a symbol with the given payload, options, and match function.
Parameters
• payload: string
| number
The payload for fetching the symbol.
• options: Options
The options for fetching the symbol.
• onMatch: Function
The function to call when a match is found.
Returns
null
| [string
, number
]
The fetched symbol tuple.
Source
getActors()
getActors(
query
,pageSize
):string
[][] |Emitter
<string
[][]>
Gets the actors from the store with the given query.
Parameters
• query: any
The query for getting the actors.
• pageSize: number
The page size for getting the actors.
Returns
string
[][] | Emitter
<string
[][]>
The actors from the store.
Source
getComponents()
getComponents(
query
,pageSize
):Components
[] |Emitter
<Components
[]>
Gets the components from the store with the given query.
Parameters
• query: any
The query for getting the components.
• pageSize: number
The page size for getting the components.
Returns
Components
[] | Emitter
<Components
[]>
The components from the store.
Source
getEntities()
getEntities(
query
,pageSize
):string
[][] |Emitter
<string
[][]>
Gets the entities from the store with the given query.
Parameters
• query: any
The query for getting the entities.
• pageSize: number
The page size for getting the entities.
Returns
string
[][] | Emitter
<string
[][]>
The entities from the store.
Source
getInputs()
Gets the inputs from the store with the given query.
Parameters
• query: any
The query for getting the inputs.
• pageSize: number
The page size for getting the inputs.
Returns
The inputs from the store.
Source
getSymbol()
getSymbol(
index
,options
):any
Gets a symbol with the given index and options.
Parameters
• index: number
The index of the symbol to get.
• options: Options
The options for getting the symbol.
Returns
any
The symbol.
Source
mergeActors()
mergeActors(
payload
,options
):void
|Promise
<any
[]>
Merges actors with the given payload and options.
Parameters
• payload: any
[]
The payload of the actors to merge.
• options: Options
The options for merging the actors.
Returns
void
| Promise
<any
[]>
Source
mergeComponents()
mergeComponents(
payload
,options
):void
|Promise
<any
[]>
Merges components with the given payload and options.
Parameters
• payload: any
The payload of the components to merge.
• options: Options
The options for merging the components.
Returns
void
| Promise
<any
[]>
Source
mergeEntities()
mergeEntities(
payload
,options
):void
|Promise
<any
[]>
Merges entities with the given payload and options.
Parameters
• payload: string
[]
The payload of the entities to merge.
• options: Options
The options for merging the entities.
Returns
void
| Promise
<any
[]>
Source
mergeSymbol()
mergeSymbol(
payload
,options
):undefined
|null
Merges a symbol with the given payload and options.
Parameters
• payload: [string
, number
]
The payload for merging the symbol.
• options: Options
The options for merging the symbol.
Returns
undefined
| null
Source
removeActor()
removeActor(
id
,options
):boolean
|Promise
<boolean
>
Removes an actor with the given id and options.
Parameters
• id: string
The id of the actor to remove.
• options: Options
The options for removing the actor.
Returns
boolean
| Promise
<boolean
>
Source
removeComponent()
removeComponent(
id
,key
,options
):boolean
|Promise
<boolean
>
Removes a component with the given id, key, and options.
Parameters
• id: string
The id of the component to remove.
• key: string
The key of the component to remove.
• options: Options
The options for removing the component.
Returns
boolean
| Promise
<boolean
>
Source
removeEntity()
removeEntity(
id
,options
):boolean
|Promise
<boolean
>
Removes an entity with the given id and options.
Parameters
• id: string
The id of the entity to remove.
• options: Options
The options for removing the entity.
Returns
boolean
| Promise
<boolean
>
Source
resetFrame()
resetFrame():
void
Resets the current frame state.
Returns
void
Source
resetSymbols()
resetSymbols(
offset
,symbols
,options
):undefined
|null
Resets symbols with the given payload and options.
Parameters
• offset: number
= 0
• symbols: any
[]
• options: Options
The options for resetting the symbols.
Returns
undefined
| null
Source
setSymbols()
setSymbols(
symbols
):void
Sets the symbols with the given symbols.
Parameters
• symbols: any
The symbols to set.
Returns
void
Source
spawnActor()
spawnActor(
id
,options
):boolean
|Promise
<boolean
>
Spawns an actor with the given id and options.
Parameters
• id: string
The id of the actor to spawn.
• options: Options
The options for spawning the actor.
Returns
boolean
| Promise
<boolean
>
Source
upsertComponent()
upsertComponent(
id
,key
,value
,tick
,options
):any
Upserts a component with the given id, key, value, and options.
Parameters
• id: string
| Uint32Array
| string
[]
The id of the component to upsert.
• key: string
The key of the component to upsert.
• value: any
The value to upsert in the component.
• tick: number
= 0
The tick value for the component. Defaults to 0.
• options: Options
The options for upserting the component.
Returns
any
Source
ensure()
static
ensure(context
,options
,_Storage
):Context
Ensures that the given context is an instance of the Context class.
Parameters
• context: Context
| ContextProps
The context to ensure.
• options: any
The options for ensuring the context.
• _Storage: typeof Storage
= Storage
The store.
Returns
The context.
Source
Generated using typedoc-plugin-markdown and TypeDoc