UNPKG

homebridge-homeconnect

Version:

A Homebridge plugin that connects Home Connect appliances to Apple HomeKit

33 lines 1.14 kB
// Homebridge plugin for Home Connect home appliances // Copyright © 2023-2026 Alexander Thoukydides import { detached } from '../../log-error.js'; // Client-side IPC implementation export class ClientIPC { // Create a new client IPC instance constructor(log) { this.log = log; } // Issue a request to the server async request(path, data) { try { this.log.debug(`request("${path}", %O)`, data); const result = await window.homebridge.request(path, data); this.log.debug(`request("${path}", %O) =>`, data, result); return result; } catch (err) { this.log.error(`request("${path}", %O) =>`, data, err); throw err; } } // Add an event listener onEvent(event, callback) { window.homebridge.addEventListener(event, detached(this.log, 'onEvent', async (evt) => { const data = evt.data; if (event !== 'log') this.log.debug(`onEvent("${event}") => callback`, data); await callback(data); })); } } //# sourceMappingURL=client-ipc.js.map