evcc-io/assets/js/utils/native.ts
Maschga abf34f1fc4
chore: Typescript: Rewrite utils (#21660)
Co-authored-by: Michael Geers <michael@geers.tv>
2025-06-20 15:33:52 +00:00

14 lines
335 B
TypeScript

export function isApp() {
return navigator.userAgent.includes("evcc/");
}
export function appDetection() {
if (isApp()) {
const $html = document.querySelector("html");
$html?.classList.add("app");
}
}
export function sendToApp(data: { type: string }) {
window.ReactNativeWebView?.postMessage(JSON.stringify(data));
}