This site describes solve-engine as it is on main: 2.43.0, which npm does not have yet. npm installs 2.40.0, so a page may show an answer that version does not give yet.
WorkerTransport
Defined in: packages/engine/src/worker/transport.ts:19
A bidirectional message channel with a single receive handler.
onMessage registers the one handler the harness needs; calling it again
replaces the previous handler. terminate tears the channel down and is safe
to call more than once.
Methods
Section titled “Methods”onMessage()
Section titled “onMessage()”onMessage(handler): void;Defined in: packages/engine/src/worker/transport.ts:23
Register the handler that receives messages from the other end.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
handler | (message) => void |
Returns
Section titled “Returns”void
postMessage()
Section titled “postMessage()”postMessage(message): void;Defined in: packages/engine/src/worker/transport.ts:21
Send one message to the other end. The message must be clone-safe.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
message | unknown |
Returns
Section titled “Returns”void
terminate()
Section titled “terminate()”terminate(): void;Defined in: packages/engine/src/worker/transport.ts:25
Tear the channel down. Idempotent.
Returns
Section titled “Returns”void