MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / any

Method any

examples/io/streams/modules/streams.js:95–116  ·  view source on GitHub ↗
(iterable)

Source from the content-addressed store, hash-verified

93 return signal.self;
94 }
95 static any(iterable) {
96 const signal = new AbortSignal(AbortSignalBrand.token);
97 const sources = [];
98 for (let self of iterable) {
99 const source = AbortSignalBrand.get(self);
100 if (sources.indexOf(source) < 0)
101 source.push(source);
102 }
103 for (let source of sources) {
104 if (source.aborted) {
105 triggerAbortSignal(signal, source.reason);
106 return signal.self;
107 }
108 }
109 for (let source of sources) {
110 if (source.dependents)
111 source.dependents.push(signal);
112 else
113 source.dependents = [ signal ];
114 }
115 return signal.self;
116 }
117 static timeout(duration) {
118 const signal = new AbortSignal(AbortSignalBrand.token);
119 setTimeout(() => {

Callers

nothing calls this directly

Calls 3

triggerAbortSignalFunction · 0.85
getMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected