Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | import net from 'net'; import * as utils from 'sportident/lib/utils'; import {ISiExternalApplication, SiExternalApplicationEvents, SiExternalApplicationReceiveEvent} from 'sportident-testbench-shell/lib/ISiExternalApplication'; export class SiExternalApplication implements ISiExternalApplication { private unixSocket: net.Socket; constructor(pipeUrl: string) { this.unixSocket = net.createConnection(pipeUrl); this.unixSocket.on('data', (data) => { const uint8Data = [...data]; this.handleSocketReceive(uint8Data); }); } handleSocketReceive(uint8Data: number[]): void { this.dispatchEvent( 'receive', new SiExternalApplicationReceiveEvent(this, uint8Data), ); } send(uint8Data: number[]): void { this.unixSocket.write(new Uint8Array(uint8Data)); } close(): void { this.unixSocket.destroy(); } } // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface SiExternalApplication extends utils.EventTarget<SiExternalApplicationEvents> {} utils.applyMixins(SiExternalApplication, [utils.EventTarget]); |