Module
Web.Worker.Worker
- Package
- purescript-web-workers
- Repository
- purescript-web/purescript-web-workers
This module contains function to create and control workers from the parent's worker
#new Source
new :: String -> WorkerOptions -> Effect Worker
creates a worker object that executes the script at the specified URL.
#onMessageError Source
onMessageError :: (MessageEvent -> Effect Unit) -> Worker -> Effect Unit
fired when the worker's parent receives a message that can't be deserialized.
#postMessage Source
postMessage :: forall msg. IsSendable msg => msg -> Worker -> Effect Unit
sends a message to the worker's inner scope.
#postMessage' Source
postMessage' :: forall msg. IsSendable msg => msg -> Array Transferable -> Worker -> Effect Unit
#toEventTarget Source
toEventTarget :: Worker -> EventTarget
Re-exports from Web.Worker.Options
#WorkerOptions Source
type WorkerOptions = { name :: String, type :: WorkerType }