Module

Effect.Worker.Child

Package
purescript-workly
Repository
cakekindel/purescript-workly

Module defining the Worker type and a low-level API for interacting with parent threads from the worker module.

#sendMsg Source

sendMsg :: forall up. up -> Effect Unit

Internal binding for the postMessage function available in the global scope of web worker modules.

MDN

import Effect.Worker (Worker, sendMsg)

worker :: Worker String _

sendMsg "hello" worker

#onMsg Source

onMsg :: forall dn. (MessageEvent dn -> Effect Unit) -> Effect Unit

Internal binding for attaching a listener to the onmessage property of the global scope of web worker modules.

MDN

import Effect.Worker (Worker, sendMsg)

worker :: Worker String _

onMsg (\(m :: String) -> log m) worker