{"image":"daf01c05298d2520430802e452378e8733dfaadc","timer":null,"choices":[],"notifications":[],"prompting":false,"awaiting_comfirm":true}
page
setInterval
awaiting_confirm
Page JSON {"image":"daf01c05298d2520430802e452378e8733dfaadc","timer":null,"choices":[],"notifications":[],"prompting":false,"awaiting_comfirm":true}Parsed page Object { image: "daf01c05298d2520430802e452378e8733dfaadc", timer: null, choices: [], notifications: [], prompting: false, awaiting_comfirm: true }Stored page Object { image: "daf01c05298d2520430802e452378e8733dfaadc", timer: null, choices: Proxy, notifications: Proxy, prompting: false, awaiting_comfirm: true }Prompting false, Awaiting confirm: undefined
engine.tick(BigInt(250)); const pageJson = engine.renderPage(); console.log(`Page JSON ${pageJson}`); const pageParsed = JSON.parse(pageJson) as Page; console.log("Parsed page", pageParsed); setPage(pageParsed); console.log("Stored page", {...page}); console.log(`Prompting ${page.prompting}, Awaiting confirm: ${page.awaiting_confirm}`);
Page JSON {"image":"daf01c05298d2520430802e452378e8733dfaadc","timer":null,"choices":[],"notifications":[],"prompting":false,"awaiting_comfirm":true}Parsed page Object { image: "daf01c05298d2520430802e452378e8733dfaadc", timer: null, choices: [], notifications: [], prompting: false, awaiting_comfirm: true }Stored page Object { image: "daf01c05298d2520430802e452378e8733dfaadc", timer: null, choices: Proxy, notifications: Proxy, prompting: false, awaiting_confirm: false, awaiting_comfirm: true }Prompting false, Awaiting confirm: false App.tsx:60:14
import { createStore } from "solid-js/store";import { render } from "solid-js/web";import { Show, onMount, onCleanup } from "solid-js";function Counter() { const [meta, setMeta] = createStore({ nested: false }); let interval: number; onMount(() => { interval = setInterval(() => { if (meta.nested) { setMeta(JSON.parse('{"nested": false}')); } else { setMeta(JSON.parse('{"nested": true}')); } }, 2500); }); onCleanup(() => clearInterval(interval)); return ( <Show when={meta.nested}> <p>Some text</p> </Show> );}render(() => <Counter />, document.getElementById("app")!);
Page JSON {"image":"daf01c05298d2520430802e452378e8733dfaadc","timer":null,"choices":[],"notifications":[],"prompting":false,"awaiting_comfirm":true} Awaiting confirm false, prompting false
setInterval(() => { engine.tick(BigInt(250)); const pageJson = engine.renderPage(); console.log(`Page JSON ${pageJson}`); setPage(JSON.parse(pageJson)); console.log(`Awaiting confirm ${page.awaiting_confirm}, prompting ${page.prompting}`);}, 250);
const [page, setPage] = createStore({ image: null, timer: null, choices: [], notifications: [], prompting: false, awaiting_confirm: false, } as Page)// snip{page.awaiting_confirm ? <p>I'm awaiting confirm</p> : <p>I'm not awaiting confirm</p>}<br /><Show when={page.awaiting_confirm}> <button onClick={() => engine.clearAwaitingConfirm()}>Continue</button></Show>