| 133 | |
| 134 | /** @internal */ |
| 135 | export class Track implements Supervisor.Supervisor<Array<Fiber.RuntimeFiber<any, any>>> { |
| 136 | readonly [SupervisorTypeId] = supervisorVariance |
| 137 | |
| 138 | readonly fibers: Set<Fiber.RuntimeFiber<any, any>> = new Set() |
| 139 | |
| 140 | get value(): Effect.Effect<Array<Fiber.RuntimeFiber<any, any>>> { |
| 141 | return core.sync(() => Array.from(this.fibers)) |
| 142 | } |
| 143 | |
| 144 | onStart<A, E, R>( |
| 145 | _context: Context.Context<R>, |
| 146 | _effect: Effect.Effect<A, E, R>, |
| 147 | _parent: Option.Option<Fiber.RuntimeFiber<any, any>>, |
| 148 | fiber: Fiber.RuntimeFiber<A, E> |
| 149 | ): void { |
| 150 | this.fibers.add(fiber) |
| 151 | } |
| 152 | |
| 153 | onEnd<A, E>(_value: Exit.Exit<A, E>, fiber: Fiber.RuntimeFiber<A, E>): void { |
| 154 | this.fibers.delete(fiber) |
| 155 | } |
| 156 | |
| 157 | onEffect<A, E>(_fiber: Fiber.RuntimeFiber<A, E>, _effect: Effect.Effect<any, any, any>): void { |
| 158 | // |
| 159 | } |
| 160 | |
| 161 | onSuspend<A, E>(_fiber: Fiber.RuntimeFiber<A, E>): void { |
| 162 | // |
| 163 | } |
| 164 | |
| 165 | onResume<A, E>(_fiber: Fiber.RuntimeFiber<A, E>): void { |
| 166 | // |
| 167 | } |
| 168 | |
| 169 | map<B>(f: (a: Array<Fiber.RuntimeFiber<any, any>>) => B): Supervisor.Supervisor<B> { |
| 170 | return new ProxySupervisor(this, pipe(this.value, core.map(f))) |
| 171 | } |
| 172 | |
| 173 | zip<A>( |
| 174 | right: Supervisor.Supervisor<A> |
| 175 | ): Supervisor.Supervisor<[Array<Fiber.RuntimeFiber<any, any>>, A]> { |
| 176 | return new Zip(this, right) |
| 177 | } |
| 178 | |
| 179 | onRun<E, A, X>(execution: () => X, _fiber: Fiber.RuntimeFiber<A, E>): X { |
| 180 | return execution() |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | /** @internal */ |
| 185 | export class Const<out T> implements Supervisor.Supervisor<T> { |
nothing calls this directly
no outgoing calls
no test coverage detected