This commit is contained in:
TreetopFlyer 2022-04-26 10:39:25 -04:00
parent 18a02d7490
commit 034067f796
3 changed files with 13 additions and 19 deletions

7
app.js
View File

@ -7,7 +7,8 @@ import { useReducer, useState, useEffect, useLayoutEffect, useMemo, useRef } fro
import State01 from "./testdata-01.json" assert { type: "json" };
import State02 from "./testdata-02.json" assert { type: "json" };
const Styles = {
const Styles =
{
Broadcast:
{
position: "relative",
@ -245,6 +246,7 @@ const DateParse = (inDateString) =>
Date: date.getDate(),
Hours: date.getHours(),
Minutes: date.getMinutes(),
Epoch: date.valueOf()
};
obj.Zone = obj.Zone ? obj.Zone[1] : "local time";
@ -255,4 +257,5 @@ const DateParse = (inDateString) =>
return obj;
};
export default App;
/** @type {(inChannel:string, inSelector:string)=>void} */
export default (inChannel, inSelector) => render(h(App, {channel:inChannel, interval:50000}), document.querySelector(inSelector));

View File

@ -2,25 +2,15 @@
<html>
<head></head>
<body>
<div style="max-width:500px; margin: 0 auto;">
<div id="boxcast"></div>
<script type="module">
import Init from "./app.js";
const Channel = { Basics: "sfz7ja3rlpoous6usu8a", Sunday: "gzahmhugrzogttfdtbjj", Dev: "r3os2zfdnhlquhuypgtp" };
Init(Channel.Basics, "#boxcast");
</script>
</div>
<script type="module">
const Channel = {
Basics: "sfz7ja3rlpoous6usu8a",
Sunday: "gzahmhugrzogttfdtbjj",
Dev: "r3os2zfdnhlquhuypgtp"
};
import { h, render } from "https://esm.sh/preact";
import App from "./app.js";
render(
h(App, {channel:Channel.Basics, interval:50000}),
document.querySelector("#boxcast")
);
</script>
</body>
</html>

3
types.d.ts vendored
View File

@ -25,7 +25,8 @@ namespace Boxcast
Date: number
Hours: number
Minutes: string | number
M?: "AM" | "PM"
M?: "AM" | "PM",
Epoch: number
}
type StateBinding<T> = [T, (item:T)=>void];