communication.layers.EventCommunicationInterface - ZeMA-gGmbH/NoPE-JS GitHub Wiki
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
-
EventCommunicationInterface
new EventCommunicationInterface(_emitter?, _logger?, receivesOwnMessages?)
Creates an instance of EventMirror.
Memberof
EventMirror
| Name | Type | Default value | Description |
|---|---|---|---|
_emitter? |
IEmitter |
undefined |
- |
_logger? |
ILogger |
undefined |
a Logger |
receivesOwnMessages |
boolean |
true |
- |
connected: INopeObservable<boolean, boolean, boolean, IEventAdditionalData>
Flag, showing whether the Mirror is connected or not.
Memberof
EventMirror
ICommunicationInterface.connected
id: string
ID of the Layer.
Author
M.Karkowski
Memberof
ICommunicationInterface
Readonly receivesOwnMessages: boolean = true
Used to show, whether the the layer receives its own messages
Memberof
ICommunicationInterface
ICommunicationInterface.receivesOwnMessages
detailListeners(type, listeners): void
Helper to detail the listeners of the "event", "rpc", "data" or "responses"
| Name | Type | Description |
|---|---|---|
type |
"event" | "rpc" | "data" | "response"
|
valid type to detail the name |
listeners |
string[] |
the currently used listeners. |
void
ICommunicationInterface.detailListeners
dispose(): Promise<void>
Disconnect the Layer.
Memberof
ICommunicationInterface
Promise<void>
{Promise}
ICommunicationInterface.dispose
emit<T>(eventname, data): Promise<void>
Function, which will be used to emit data
Memberof
EventMirror
| Name | Type |
|---|---|
T |
extends keyof EventnameToEventType
|
| Name | Type | Description |
|---|---|---|
eventname |
T |
- |
data |
EventnameToEventType[T] |
the data to emit |
Promise<void>
on<T>(eventname, cb): Promise<void>
Function which will be used to subscribe Data
Memberof
EventMirror
| Name | Type |
|---|---|
T |
extends keyof EventnameToEventType
|
| Name | Type |
|---|---|
eventname |
T |
cb |
(data: EventnameToEventType[T]) => void
|
Promise<void>