Skip to content

Commit

Permalink
fix: add console logs
Browse files Browse the repository at this point in the history
  • Loading branch information
darlanalves authored Oct 23, 2023
1 parent 161cdc3 commit 6164bcc
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,20 @@
/>
</head>
<body>
<main id="app" class="w-screen h-screen"></main>
<main id="app" class="w-screen h-screen">Loaading</main>
<script>
window._a = [];
console.log = (...args) => _a.push(args);
window.addEventListener("DOMContentLoaded", () => {
const c = document.getElementById('app');

console.log = (...args) => c.innerHTML += args.map(String).join(' ');
_a.forEach(a => console.log(...a));
});
</script>
</body>
<script type="module">

<script type="module" onerror="console.log(...arguments)">
import { State } from 'https://s.homebots.io/state.mjs';
import {
getProperty,
Expand Down Expand Up @@ -81,7 +92,7 @@
}
}

const applyColor = async (color) => {
async function applyColor(color) {
speak(color.name);

const colorString = [color.angle, 100, 100].join(",");
Expand All @@ -96,9 +107,9 @@

await delay(200);
}
};
}

const reset = async () => {
async function reset() {
const { clientId, clientSecret, deviceIds, state } = await getProperties();

await state.remove('color');
Expand All @@ -108,7 +119,7 @@
headers: { clientId, clientSecret },
});
}
};
}

window.addEventListener("DOMContentLoaded", async () => {
const main = document.querySelector("main");
Expand All @@ -122,6 +133,7 @@
try {
await getProfile();
} catch {
console.log('auth');
signIn();
return;
}
Expand Down Expand Up @@ -157,7 +169,7 @@

await changeColor();
} catch (e) {
document.getElementById('app').innerHTML = String(e);
console.log(e);
}
}

Expand Down

0 comments on commit 6164bcc

Please sign in to comment.