MCPcopy Create free account
hub / github.com/Effect-TS/effect / emit

Function emit

packages/experimental/src/Sse.ts:97–111  ·  view source on GitHub ↗
(chunks)

Source from the content-addressed store, hash-verified

95 return Effect.void
96 },
97 emit(chunks) {
98 let error: SseError | undefined
99 Chunk.forEach(chunks, (chunk) => {
100 if (error === undefined) {
101 error = parser.feed(chunk)
102 }
103 })
104 const toEmit = events
105 events = []
106 return error
107 ? Effect.zipRight(mailbox.offerAll(toEmit), mailbox.failCause(Cause.die(error)))
108 : retry
109 ? Effect.zipRight(mailbox.offerAll(toEmit), mailbox.fail(retry))
110 : mailbox.offerAll(toEmit)
111 },
112 error(cause) {
113 return mailbox.failCause(cause)
114 },

Callers

nothing calls this directly

Calls 5

feedMethod · 0.80
failCauseMethod · 0.80
offerAllMethod · 0.65
dieMethod · 0.65
failMethod · 0.65

Tested by

no test coverage detected