Making web workers, web sockets, WebRTC, and other web-based APIs first-class actors in `xstate`.
Making web workers, web sockets, WebRTC, and other web-based APIs first-class actors in
xstate
.
This package is not yet release as it is in a very early alpha state. If you would like to use any of these helpers now its recommended to copy and paste them into your codebase for the time being!
If you have any ideas for other Web APIs to support please file an issue!
Any of the helper functions exported from this library can be used to invoke or spawn an actor that wraps around a certain Web API.
fromDynamicImport
It is assumed that events sent to/from the worker are of the type EventObject
, otherwise they are ignored.
fromWebWorker
interpretInWebWorker
sendParent
in your machine to send events out of the web worker.fromSharedWorker
interpretInSharedWorker
sendParent
in your machine to send events out of the web worker.fromServiceWorker
EventObject
.fromAudioWorklet
AudioWorklet
.It is assumed that events sent over the network are of the type EventObject
, otherwise they are ignored.
fromWebSocket
fromEventSource
fromWebRTC
(TODO)
fromEventBus
EventBus
is a class that encapsulates an event bus. This is not a web API.fromBroadCastChannel
BroadcastChannel
to communicate with anyone else listeningfromEventListener
fromPostMessage
(TODO)fromMessageChannel
(TODO)