Skip to content

@emile/engine


@emile/engine / core/actions / ActionsManager

Class: ActionsManager<T>

Defined in: src/core/actions.ts:12

Type Parameters

T

T

Constructors

new ActionsManager()

new ActionsManager<T>(): ActionsManager<T>

Returns

ActionsManager<T>

Methods

clear()

clear(): void

Defined in: src/core/actions.ts:92

Clears all handlers from the manager.

Returns

void


enqueue()

enqueue(action, data, delay?): void

Defined in: src/core/actions.ts:23

Enqueues an action to be fired on the next flush.

Parameters

action

T

The action to enqueue.

data

any

The data for the action.

delay?

number

The delay in milliseconds before enqueueing the action, this is useful to simulate sending the action to the server on the client.

Returns

void


fire()

fire(engine, action, data, dt): void

Defined in: src/core/actions.ts:59

Fires an action immediately with the given data, without queueing the action.

Parameters

engine

Engine

The engine firing the action.

action

T

The action to fire.

data

any

The action's data.

dt

number

The delta time for the action.

Returns

void

Note

Use this with caution, as it will bypass the queue and fire the action immediately.


flush()

flush(engine, dt): void

Defined in: src/core/actions.ts:41

Flushes the action queue, firing all enqueued actions.

Parameters

engine

Engine

The engine to flushing the queue.

dt

number

The delta time for the update calling the flush.

Returns

void

Note

Only use this if you know what you're doing.


register()

register<D>(action, handler): void

Defined in: src/core/actions.ts:76

Registers a handler for an action.

If a handler is already registered for the action, it will be replaced.

Type Parameters

D

D

Parameters

action

T

The action to register the handler for.

handler

ActionHandler<T, D>

The handler for the action.

Returns

void


unregister()

unregister(action): void

Defined in: src/core/actions.ts:85

Unregisters the handler for an action.

Parameters

action

T

The action to unregister the handler for.

Returns

void