MCPcopy Create free account
hub / github.com/TruthHun/BookStack / cleanup

Function cleanup

static/word2md/mammoth.browser.js:24667–24687  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24665
24666 var cleanedUp = false;
24667 function cleanup() {
24668 debug('cleanup');
24669 // cleanup event handlers once the pipe is broken
24670 dest.removeListener('close', onclose);
24671 dest.removeListener('finish', onfinish);
24672 dest.removeListener('drain', ondrain);
24673 dest.removeListener('error', onerror);
24674 dest.removeListener('unpipe', onunpipe);
24675 src.removeListener('end', onend);
24676 src.removeListener('end', cleanup);
24677 src.removeListener('data', ondata);
24678
24679 cleanedUp = true;
24680
24681 // if the reader is waiting for a drain event from this
24682 // specific writer, then it would cause it to never start
24683 // flowing again.
24684 // So, if this is awaiting a drain, then we just call it now.
24685 // If we don't know, then assume that we are waiting for one.
24686 if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
24687 }
24688
24689 // If the user pushes more data while we're writing to dest then we'll end up
24690 // in ondata again. However, we only want to increase awaitDrain once because

Callers 2

onunpipeFunction · 0.70
onerrorFunction · 0.70

Calls 1

ondrainFunction · 0.70

Tested by

no test coverage detected