Actor
An implementation of the Actor design pattern that maintains the relationship between asynchronous tasks and the objects that spin them off - in this case, tasks like parsing parts of styles, owned by the styles
Implements
Constructors
new Actor()
new Actor(
target
:ActorTarget
,mapId
?:string
|number
):Actor
Parameters
Parameter | Type | Description |
---|---|---|
target |
ActorTarget |
The target |
mapId ? |
string | number |
A unique identifier for the Map instance using this Actor. |
Returns
Defined in
Methods
sendAsync()
sendAsync<
T
>(message
:ActorMessage
<T
>,abortController
?:AbortController
):Promise
<RequestResponseMessageMap
[T
][1
]>
Sends a message from a main-thread map to a Worker or from a Worker back to a main-thread map instance.
Type Parameters
Type Parameter |
---|
T extends MessageType |
Parameters
Parameter | Type | Description |
---|---|---|
message |
ActorMessage <T > |
the message to send |
abortController ? |
AbortController |
an optional AbortController to abort the request |
Returns
Promise
<RequestResponseMessageMap
[T
][1
]>
a promise that will be resolved with the response data
Implementation of
IActor.sendAsync