(trigger)
| 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 | }, |
nothing calls this directly
no test coverage detected