MCPcopy Create free account
hub / github.com/bywwcnll/StreamPanel / createObservedIterator

Function createObservedIterator

inject.js:599–612  ·  view source on GitHub ↗
(originalIteratorFactory, iteratorArgs)

Source from the content-addressed store, hash-verified

597 };
598
599 const createObservedIterator = function(originalIteratorFactory, iteratorArgs) {
600 const observer = streamObserverMap.get(this);
601 if (!observer) {
602 return originalIteratorFactory.apply(this, iteratorArgs);
603 }
604
605 streamsCreatingAsyncIterator.add(this);
606 try {
607 const iterator = originalIteratorFactory.apply(this, iteratorArgs);
608 return wrapAsyncIterator(this, iterator, observer);
609 } finally {
610 streamsCreatingAsyncIterator.delete(this);
611 }
612 };
613
614 if (typeof originalValues === 'function') {
615 proto.values = function(...valuesArgs) {

Callers

nothing calls this directly

Calls 1

wrapAsyncIteratorFunction · 0.85

Tested by

no test coverage detected