Class: StubMessenger
messenger.StubMessenger
Stub implementation of the Messenger interface. Simply stores messages in memory. Useful for testing purposes.
Implements
Constructors
constructor
• new StubMessenger()
Properties
messages
• messages: { message
: Message
<any
> ;
recipient
: string
}[] = []
An array of messages passed to the send method. Sorted from most recent to oldest.
Defined in
Methods
lastMessage
▸ lastMessage(addr
): null
| Message
<any
>
Returns the most recent message sent to addr
.
Parameters
Name | Type |
---|---|
addr |
string |
Returns
null
| Message
<any
>
Defined in
send
▸ send<T
>(recipient
, message
): Promise
<void
>
Sends a message to a given address
Type parameters
Name | Type |
---|---|
T |
extends MessageData |
Parameters
Name | Type |
---|---|
recipient |
string |
message |
Message <T > |
Returns
Promise
<void
>