(emit: LoopLiveEventEmitter | undefined, event: LoopEvent)
| 179 | } |
| 180 | |
| 181 | function safeEmitLive(emit: LoopLiveEventEmitter | undefined, event: LoopEvent): void { |
| 182 | if (emit === undefined) return; |
| 183 | let maybePromise: unknown; |
| 184 | try { |
| 185 | maybePromise = (emit as (event: LoopEvent) => unknown)(event); |
| 186 | } catch { |
| 187 | return; |
| 188 | } |
| 189 | if ( |
| 190 | maybePromise !== undefined && |
| 191 | maybePromise !== null && |
| 192 | typeof (maybePromise as { then?: unknown }).then === 'function' && |
| 193 | typeof (maybePromise as { catch?: unknown }).catch === 'function' |
| 194 | ) { |
| 195 | (maybePromise as Promise<unknown>).catch(() => { |
| 196 | // Live listeners are best-effort; their failures must not affect the turn. |
| 197 | }); |
| 198 | } |
| 199 | } |
no outgoing calls
no test coverage detected