Solid · API

stream.destroy

Stops the stream permanently, at any point in the reply. Its listeners are removed, a later write has no effect, and a pending final() promise rejects. current() still returns the value from the time of the call.

Schema
z.object({ show: z.string(), night: z.string() })
Listener and promise
stream.on(() => { calls += 1 })
const end = stream.final()
Stream destroyed mid-reply
Reply so far
{"show":"The Tempest",
Value, listener calls, final()
{
  value: { show: 'The Tempest', night: '' },
  listenerCalls: 2,
  final: 'waiting',
}
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.