(message: string)
| 48 | * Send a message to stdout (Chrome native messaging protocol) |
| 49 | */ |
| 50 | export function sendChromeMessage(message: string): void { |
| 51 | const jsonBytes = Buffer.from(message, 'utf-8') |
| 52 | const lengthBuffer = Buffer.alloc(4) |
| 53 | lengthBuffer.writeUInt32LE(jsonBytes.length, 0) |
| 54 | |
| 55 | process.stdout.write(lengthBuffer) |
| 56 | process.stdout.write(jsonBytes) |
| 57 | } |
| 58 | |
| 59 | export async function runChromeNativeHost(): Promise<void> { |
| 60 | log('Initializing...') |
no test coverage detected