MCPcopy Create free account
hub / github.com/effect-app/libs / onMessage

Function onMessage

repos/effect/packages/sql/sqlite-wasm/src/SqliteClient.ts:322–344  ·  view source on GitHub ↗
(event: any)

Source from the content-addressed store, hash-verified

320 yield* Scope.addFinalizer(scope, Effect.sync(() => postMessage(["close"])))
321
322 const onMessage = (event: any) => {
323 const [id, error, results] = event.data
324 if (id === "ready") {
325 Deferred.doneUnsafe(readyDeferred, Exit.void)
326 return
327 } else if (id === "update_hook") {
328 reactivity.invalidateUnsafe({ [error]: [results] })
329 return
330 } else {
331 const resume = pending.get(id)
332 if (!resume) return
333 pending.delete(id)
334 if (error) {
335 resume(
336 Exit.fail(
337 new SqlError({ reason: classifyError(error as string, "Failed to execute statement", "execute") })
338 )
339 )
340 } else {
341 resume(Exit.succeed(results))
342 }
343 }
344 }
345 port.addEventListener("message", onMessage)
346
347 function onError(cause: Event) {

Callers

nothing calls this directly

Calls 5

classifyErrorFunction · 0.70
getMethod · 0.65
resumeFunction · 0.50
failMethod · 0.45
succeedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…