mirror of
https://github.com/sr229/kuru-kuru.git
synced 2024-09-20 04:10:33 +00:00
Add debugging
Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
parent
78a43c846e
commit
062a03c708
2 changed files with 6 additions and 5 deletions
|
@ -5,7 +5,7 @@ import axios from "axios-web";
|
|||
|
||||
interface SharedProps {
|
||||
hasClicked: Signal<boolean>;
|
||||
globalCount: string;
|
||||
globalCount: Signal<number>;
|
||||
}
|
||||
|
||||
export default function Counter(props: SharedProps) {
|
||||
|
@ -72,7 +72,7 @@ export default function Counter(props: SharedProps) {
|
|||
</div>
|
||||
<div class="px-6 pt-4 pb-2">
|
||||
<p>
|
||||
Everyone has clicked the button {parseInt(props.globalCount)} times!
|
||||
Everyone has clicked the button {props.globalCount} times!
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -42,13 +42,14 @@ export const handler: Handlers = {
|
|||
// broadcast new value to everyone
|
||||
const bc = new BroadcastChannel("global-count");
|
||||
bc.postMessage(getGlobalStatistics().toString());
|
||||
|
||||
|
||||
return Response.json({ success: true })
|
||||
}
|
||||
}
|
||||
|
||||
export default function Home(data: string) {
|
||||
export default function Home() {
|
||||
const hasClicked = useSignal(false);
|
||||
const globalCount = useSignal(0);
|
||||
return (
|
||||
<div class="px-4 py-8 mx-auto bg-[#9d88d3]">
|
||||
<div class="max-w-screen-md mx-auto flex flex-col items-center justify-center">
|
||||
|
@ -58,7 +59,7 @@ export default function Home(data: string) {
|
|||
<code class="mx-2">./routes/index.tsx</code> file, and refresh.
|
||||
</p>
|
||||
<Counter
|
||||
globalCount={data}
|
||||
globalCount={globalCount}
|
||||
hasClicked={hasClicked}/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue