Handler
The Handler class. It handles messages.
Constructors
new Handler(context, options, actions, _Storage)
new Handler(
context
,options
,actions
,_Storage
):Handler
Creates a new Handler instance.
Parameters
• context: any
The context for the handler.
• options: any
The options for the handler.
• actions: Object
The actions for the handler.
• _Storage: typeof Storage
= Storage
The storage for the handler.
Returns
Source
Properties
context
context:
Context
Source
options
options:
Options
Source
Accessors
store
get
store():StorageInterface
Gets the store from the context.
Returns
Source
Methods
actorInput()
actorInput(
id
,input
,tick
,extendOptions
):number
|Promise
<number
>
Updates an actor with an input.
Parameters
• id: string
The ID of the actor to update.
• input: any
The input for updating.
• tick: number
= undefined
The tick for updating.
• extendOptions: any
Custom options to extend the options for the handler.
Returns
number
| Promise
<number
>
Source
changeComponent()
changeComponent(
id
,key
,value
,tick
,extendOptions
):void
|Promise
<any
>
Changes a component of an entity.
Parameters
• id: string
The ID of the entity to change the component of.
• key: string
The key of the component to change.
• value: any
The value of the component to change.
• tick: number
= undefined
The tick for updating.
• extendOptions: any
Custom options to extend the options for the handler.
Returns
void
| Promise
<any
>
Source
createEntity()
createEntity(
id
,extendOptions
):boolean
|Promise
<boolean
>
Creates an entity.
Parameters
• id: string
The ID of the entity to create.
• extendOptions: any
Custom options to extend the options for the handler.
Returns
boolean
| Promise
<boolean
>
Source
getActionHandler()
getActionHandler(
action
): [Function
,string
]
Gets the action handler.
Parameters
• action: string
| number
Returns
[Function
, string
]
Source
getSymbolAction()
getSymbolAction(
action
):string
Gets the symbol action.
Parameters
• action: string
| number
The action.
Returns
string
Source
many()
many(
message
,extendOptions
):void
Handles multiple messages.
Parameters
• message: any
[] | Message
The messages to handle.
• extendOptions: any
Returns
void
Source
one()
one(
message
,extendOptions
):void
Handles a single message.
Parameters
• message: any
[] | Message
The message to handle.
• extendOptions: any
Returns
void
Source
queryComponents()
queryComponents(
query
):Set
<any
> |Promise
<Set
<any
>>
Queries components.
Parameters
• query: any
The query for querying components.
Returns
Set
<any
> | Promise
<Set
<any
>>
The components queried.
Source
removeActor()
removeActor(
id
,extendOptions
):boolean
|Promise
<boolean
>
Despawns an actor.
Parameters
• id: string
The ID of the actor to despawn.
• extendOptions: any
Custom options to extend the options for the handler.
Returns
boolean
| Promise
<boolean
>
Source
removeComponent()
removeComponent(
id
,key
,extendOptions
):boolean
|Promise
<boolean
>
Removes a component from an entity.
Parameters
• id: string
The ID of the entity to remove the component from.
• key: any
The key of the component to remove.
• extendOptions: any
Custom options to extend the options for the handler.
Returns
boolean
| Promise
<boolean
>
Source
removeEntity()
removeEntity(
id
,extendOptions
):boolean
|Promise
<boolean
>
Removes an entity.
Parameters
• id: string
The ID of the entity to remove.
• extendOptions: any
Custom options to extend the options for the handler.
Returns
boolean
| Promise
<boolean
>
Source
spawnActor()
spawnActor(
id
,extendOptions
):boolean
|Promise
<boolean
>
Spawns an actor.
Parameters
• id: string
The ID of the actor to spawn.
• extendOptions: any
Custom options to extend the options for the handler.
Returns
boolean
| Promise
<boolean
>
Source
updater()
updater(
extendOptions
,tick
):Promise
<any
[]>
Updates other nodes in the network.
Parameters
• extendOptions: any
Custom options to extend the options for the handler.
• tick: number
= undefined
The tick for updating.
Returns
Promise
<any
[]>
A promise that resolves with updated batch of messages.
Source
upsertComponent()
upsertComponent(
id
,key
,value
,tick
,extendOptions
):void
|Promise
<any
>
Sets a component to an entity.
Parameters
• id: string
The ID of the entity to add the component to.
• key: string
The key of the component to add.
• value: any
The value of the component to add.
• tick: number
= undefined
The tick for updating.
• extendOptions: any
Custom options to extend the options for the handler.
Returns
void
| Promise
<any
>
Source
Generated using typedoc-plugin-markdown and TypeDoc