(sink: EventSink)
| 39 | } |
| 40 | |
| 41 | attachSink(sink: EventSink): void { |
| 42 | if (this.sink !== null && this.sink !== sink) { |
| 43 | this.sink.stopPeriodicFlush(); |
| 44 | this.sink.flushSync(); |
| 45 | } |
| 46 | this.sink = sink; |
| 47 | for (const event of this.queue) { |
| 48 | const record = toTelemetryEvent(event); |
| 49 | if (record.device_id === null && event.contextOverrides?.deviceId !== true) { |
| 50 | record.device_id = this.deviceId; |
| 51 | } |
| 52 | if (record.session_id === null && event.contextOverrides?.sessionId !== true) { |
| 53 | record.session_id = this.sessionId; |
| 54 | } |
| 55 | sink.accept(record); |
| 56 | } |
| 57 | this.queue = []; |
| 58 | } |
| 59 | |
| 60 | disable(): void { |
| 61 | this.disabled = true; |
no test coverage detected