MCPcopy Create free account
hub / github.com/deanrad/rxfx / next

Function next

operators/src/thresholdToggle.ts:39–59  ·  view source on GitHub ↗
(trigger)

Source from the content-addressed store, hash-verified

37
38 return source.subscribe({
39 next(trigger) {
40 hitsTowardThreshold += 1;
41
42 if (hitsTowardThreshold >= threshold) {
43 if (!innerSub || innerSub?.closed) {
44 innerSub = from(workCreator(trigger)).subscribe({
45 next: (inner) => {
46 const result = (mapper ? mapper(trigger, inner) : inner) as S;
47 notify.next(result);
48 },
49 error: (e) => notify.error(e)
50 });
51 } else {
52 console.log(innerSub?.closed, hitsTowardThreshold);
53 innerSub.unsubscribe();
54 innerSub = null;
55 }
56
57 hitsTowardThreshold = 0;
58 }
59 },
60 error(e) {
61 notify.error(e);
62 },

Callers

nothing calls this directly

Calls 5

mapperFunction · 0.85
subscribeMethod · 0.80
nextMethod · 0.80
errorMethod · 0.80
unsubscribeMethod · 0.80

Tested by

no test coverage detected