Sprotty
Toggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

Class. Server Action Handler Registry

sprotty-protocol / ServerActionHandlerRegistry

Class: ServerActionHandlerRegistry

Defined in: action-handler.ts:28

Use this service to register handlers to specific actions. The DiagramServer queries this registry when an action is received from the client, and falls back to the built-in behavior if no handlers are found.

Constructors

Constructor

new ServerActionHandlerRegistry(): ServerActionHandlerRegistry

Returns

ServerActionHandlerRegistry

Properties

handlers

protected readonly handlers: Map<string, ServerActionHandler<Action>[]>

Defined in: action-handler.ts:30

Methods

getHandler()

getHandler(kind): undefined | ServerActionHandler<Action>[]

Defined in: action-handler.ts:35

Returns the action handlers for the given action kind, or undefined if there are none.

Parameters

kind

string

Returns

undefined | ServerActionHandler<Action>[]


onAction()

onAction<A>(kind, handler): void

Defined in: action-handler.ts:42

Add an action handler to be called when an action of the specified kind is received.

Type Parameters

A

A extends Action

Parameters

kind

string

handler

ServerActionHandler<A>

Returns

void


removeActionHandler()

removeActionHandler<A>(kind, handler): void

Defined in: action-handler.ts:53

Remove an action handler that was previously added with onAction.

Type Parameters

A

A extends Action

Parameters

kind

string

handler

ServerActionHandler<A>

Returns

void