Module

Aff.Workers.Shared

Package
purescript-workers
Repository
truqu/purescript-workers

#new Source

new :: forall e. String -> Aff (worker :: WORKER | e) Shared

Returns a new Worker object. scriptURL will be fetched and executed in the background, creating a new global environment for which worker represents the communication channel.

#new' Source

new' :: forall e. String -> Options -> Aff (worker :: WORKER | e) Shared

Returns a new Worker object. scriptURL will be fetched and executed in the background, creating a new global environment for which worker represents the communication channel. options can be used to define the name of that global environment via the name option, primarily for debugging purposes. It can also ensure this new global environment supports JavaScript modules (specify type: "module"), and if that is specified, can also be used to specify how scriptURL is fetched through the credentials option

#port Source

port :: Shared -> MessagePort

Aborts worker’s associated global environment.

Re-exports from Aff.MessagePort

#MessagePort Source

#start Source

start :: forall e. MessagePort -> Aff (worker :: WORKER | e) Unit

TODO DOC

#onMessageError Source

onMessageError :: forall e' e. MessagePort -> (Error -> Eff e' Unit) -> Aff (worker :: WORKER | e) Unit

Event handler for the messageError event

#onMessage Source

onMessage :: forall msg e' e. MessagePort -> (msg -> Eff e' Unit) -> Aff (worker :: WORKER | e) Unit

Event handler for the message event

#close Source

close :: forall e. MessagePort -> Aff (worker :: WORKER | e) Unit

TODO DOC

Re-exports from Aff.Workers

#WorkerType Source

#WORKER Source

data WORKER :: Effect

#Options Source

type Options = { name :: String, requestCredentials :: Credentials, workerType :: WorkerType }

#Location Source

#postMessage' Source

postMessage' :: forall channel transfer msg e. Channel channel => channel -> msg -> Array transfer -> Aff (exception :: EXCEPTION, worker :: WORKER | e) Unit

Clones message and transmits it to the port object associated with dedicatedportGlobal.transfer can be passed as a list of objects that are to be transferred rather than cloned.

#postMessage Source

postMessage :: forall channel msg e. Channel channel => channel -> msg -> Aff (exception :: EXCEPTION, worker :: WORKER | e) Unit

Clones message and transmits it to the Worker object.

#onError Source

onError :: forall worker e' e. AbstractWorker worker => worker -> (Error -> Eff e' Unit) -> Aff (worker :: WORKER | e) Unit

Event handler for the error event.

Re-exports from Workers.Shared

#Shared Source