Files
client/app/renderer/js/core.js
T
omar 7287fdb63e
ci / linux-x64 (push) Failing after 1m26s
ci / linux-arm64-cross (push) Failing after 2m20s
TeamsPeach desktop client: Electron UI, Rust core bridge, TS6 stream viewer, CI
2026-10-24 03:31:54 +03:00

23 lines
641 B
JavaScript

// Thin wrapper over the preload API (window.teamspeach). Requests resolve to `result` or throw BridgeError.
export const tp = window.teamspeach;
export class BridgeError extends Error {
constructor(error) {
super(error?.message || error?.code || 'error');
this.code = error?.code ?? 'internal';
this.ts_error = error?.ts_error;
this.detail = error?.detail;
}
}
export async function call(cmd, args) {
const response = await tp.request(cmd, args);
if (!response || !response.ok) throw new BridgeError(response?.error);
return response.result;
}
export function log(level, message) {
tp.log(level, message);
}