UNPKG

homebridge-homeconnect

Version:

A Homebridge plugin that connects Home Connect appliances to Apple HomeKit

37 lines 1.22 kB
// Homebridge plugin for Home Connect home appliances // Copyright © 2023-2025 Alexander Thoukydides // 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, async (evt) => { try { const data = evt.data; if (event !== 'log') this.log.debug(`onEvent("${event}") => callback`, data); await callback(data); } catch (err) { this.log.error(`onEvent("${event}") =>`, err); } }); } } //# sourceMappingURL=client-ipc.js.map