communication.layers.EventCommunicationInterface - ZeMA-gGmbH/NoPE-JS GitHub Wiki

Class: EventCommunicationInterface

communication.layers.EventCommunicationInterface

A Basic Mirror, used to share the events in a Mirror Style. This Layer should not be used directly. this should only be extended.

Export

Implements

Hierarchy

Implements

Constructors

constructor

new EventCommunicationInterface(_emitter?, _logger?, receivesOwnMessages?)

Creates an instance of EventMirror.

Memberof

EventMirror

Parameters

Name Type Default value Description
_emitter? IEmitter undefined -
_logger? ILogger undefined a Logger
receivesOwnMessages boolean true -

Properties

connected

connected: INopeObservable<boolean, boolean, boolean, IEventAdditionalData>

Flag, showing whether the Mirror is connected or not.

Memberof

EventMirror

Implementation of

ICommunicationInterface.connected


id

id: string

ID of the Layer.

Author

M.Karkowski

Memberof

ICommunicationInterface

Implementation of

ICommunicationInterface.id


receivesOwnMessages

Readonly receivesOwnMessages: boolean = true

Used to show, whether the the layer receives its own messages

Memberof

ICommunicationInterface

Implementation of

ICommunicationInterface.receivesOwnMessages

Methods

detailListeners

detailListeners(type, listeners): void

Helper to detail the listeners of the "event", "rpc", "data" or "responses"

Parameters

Name Type Description
type "event" | "rpc" | "data" | "response" valid type to detail the name
listeners string[] the currently used listeners.

Returns

void

Implementation of

ICommunicationInterface.detailListeners


dispose

dispose(): Promise<void>

Disconnect the Layer.

Memberof

ICommunicationInterface

Returns

Promise<void>

{Promise}

Implementation of

ICommunicationInterface.dispose


emit

emit<T>(eventname, data): Promise<void>

Function, which will be used to emit data

Memberof

EventMirror

Type parameters

Name Type
T extends keyof EventnameToEventType

Parameters

Name Type Description
eventname T -
data EventnameToEventType[T] the data to emit

Returns

Promise<void>

Implementation of

ICommunicationInterface.emit


on

on<T>(eventname, cb): Promise<void>

Function which will be used to subscribe Data

Memberof

EventMirror

Type parameters

Name Type
T extends keyof EventnameToEventType

Parameters

Name Type
eventname T
cb (data: EventnameToEventType[T]) => void

Returns

Promise<void>

Implementation of

ICommunicationInterface.on

⚠️ **GitHub.com Fallback** ⚠️