Skip to content

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

Handler

Source

ecmascript/src/handler.ts:155

Properties

context

context: Context

Source

ecmascript/src/handler.ts:144


options

options: Options

Source

ecmascript/src/handler.ts:145

Accessors

store

get store(): StorageInterface

Gets the store from the context.

Returns

StorageInterface

Source

ecmascript/src/handler.ts:163

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

ecmascript/src/handler.ts:244


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

ecmascript/src/handler.ts:290


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

ecmascript/src/handler.ts:254


getActionHandler()

getActionHandler(action): [Function, string]

Gets the action handler.

Parameters

action: string | number

Returns

[Function, string]

Source

ecmascript/src/handler.ts:190


getSymbolAction()

getSymbolAction(action): string

Gets the symbol action.

Parameters

action: string | number

The action.

Returns

string

Source

ecmascript/src/handler.ts:199


many()

many(message, extendOptions): void

Handles multiple messages.

Parameters

message: any[] | Message

The messages to handle.

extendOptions: any

Returns

void

Source

ecmascript/src/handler.ts:182


one()

one(message, extendOptions): void

Handles a single message.

Parameters

message: any[] | Message

The message to handle.

extendOptions: any

Returns

void

Source

ecmascript/src/handler.ts:172


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

ecmascript/src/handler.ts:311


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

ecmascript/src/handler.ts:232


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

ecmascript/src/handler.ts:301


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

ecmascript/src/handler.ts:264


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

ecmascript/src/handler.ts:222


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

ecmascript/src/handler.ts:210


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

ecmascript/src/handler.ts:277


Generated using typedoc-plugin-markdown and TypeDoc