document.addEventListener("DOMContentLoaded", getData); async function getData() { console.log("Hi from renderer.js!"); const dataNode = document.getElementById('data'); function setData(data) { console.log(data); const text = data ? JSON.stringify(JSON.parse(data), null, 4) : "no data"; dataNode.innerText = text; } const options = { socketPath: '/tmp/sample-rest.sock', path: 'http://localhost/WeatherForecast', }; const data = await window.http.request(options); setData(data); }