UNPKG

libmodulor

Version:

A TypeScript library to create platform-agnostic applications

11 lines (10 loc) 407 B
const ERR_MISSING_STREAM_ON_CLOSE = 'execOpts.stream.onClose needs to be set in the ServerMain to avoid memory leaks'; export function defaultStreamOnClose(streamedOnce) { return async () => { if (!streamedOnce) { // No need to close or register anything if it hasn't streamed anything yet return; } throw new Error(ERR_MISSING_STREAM_ON_CLOSE); }; }