Class: IncomingEvent
Class: IncomingEvent
Class representing an IncomingEvent.
Author
Mr. Stone evensstone@gmail.com
Extends
Constructors
Constructor
protected new IncomingEvent(options): IncomingEvent;
Create an IncomingEvent.
Parameters
options
The options to create an IncomingEvent.
Returns
IncomingEvent
Overrides
Properties
locale
readonly locale: string;
The locale of the event.
metadata
readonly metadata: Record<string, unknown>;
The metadata associated with the event.
Inherited from
source
readonly source: IncomingEventSource;
The source of the event.
Overrides
timeStamp
readonly timeStamp: number;
The timestamp of the event creation.
Inherited from
type
readonly type: string;
The type of the event.
Inherited from
Accessors
platform
Get Signature
get platform(): string | symbol;
Get the platform of the event source.
Returns
string
| symbol
The platform of the event source.
Methods
clone()
clone<T>(): T;
Return a cloned instance.
Type Parameters
T
T
extends IncomingEvent
Returns
T
A cloned instance of the current class.
Inherited from
get()
Get data from metadata.
Param
The key to retrieve from metadata.
Param
The fallback value if the key is not found.
Call Signature
get<TReturn>(key): undefined | TReturn;
Get data from metadata.
Type Parameters
TReturn
TReturn
= unknown
Parameters
key
string
The key to retrieve from metadata.
Returns
undefined
| TReturn
The value associated with the key or the fallback.
Param
The key to retrieve from metadata.
Param
The fallback value if the key is not found.
Inherited from
Call Signature
get<TReturn>(key, fallback): TReturn;
Get data from metadata.
Type Parameters
TReturn
TReturn
= unknown
Parameters
key
string
The key to retrieve from metadata.
fallback
TReturn
The fallback value if the key is not found.
Returns
TReturn
The value associated with the key or the fallback.
Param
The key to retrieve from metadata.
Param
The fallback value if the key is not found.
Inherited from
getMetadataValue()
Get data from metadata.
Param
The key to retrieve from metadata.
Param
The fallback value if the key is not found.
Call Signature
getMetadataValue<TReturn>(key): undefined | TReturn;
Get data from metadata.
Type Parameters
TReturn
TReturn
= unknown
Parameters
key
string
The key to retrieve from metadata.
Returns
undefined
| TReturn
The value associated with the key or the fallback.
Param
The key to retrieve from metadata.
Param
The fallback value if the key is not found.
Inherited from
Call Signature
getMetadataValue<TReturn>(key, fallback): TReturn;
Get data from metadata.
Type Parameters
TReturn
TReturn
= unknown
Parameters
key
string
The key to retrieve from metadata.
fallback
TReturn
The fallback value if the key is not found.
Returns
TReturn
The value associated with the key or the fallback.
Param
The key to retrieve from metadata.
Param
The fallback value if the key is not found.
Inherited from
is()
is(key, value): boolean;
Check if the given value is equal to the specified value.
Parameters
key
string
The key to check.
value
unknown
The value to compare against.
Returns
boolean
True if the key's value is equal to the specified value, false otherwise.
Inherited from
isPlatform()
isPlatform(platform): boolean;
Check if the event source is from a platform.
Parameters
platform
The platform to check.
string
| symbol
Returns
boolean
True if the event source is from the platform, false otherwise.
setMetadataValue()
setMetadataValue(key, value?): this;
Add data to metadata.
Parameters
key
The key or object to add to metadata.
string
| Record
<string
, unknown
>
value?
unknown
The value to associate with the key.
Returns
this
This Event instance.
Inherited from
create()
static create(options): IncomingEvent;
Create an IncomingEvent.
Parameters
options
The options to create an IncomingEvent.
Returns
IncomingEvent
A new IncomingEvent instance.
Events
INCOMING_EVENT
static INCOMING_EVENT: string = 'stonejs@incoming_event';
INCOMING_EVENT Event name, fires on platform message.
IncomingEvent#INCOMING_EVENT