()
| 122 | const [someUnusedTopLevelSignal, setSomeUnusedTopLevelSignal] = s.createSignal(123) |
| 123 | |
| 124 | const App: s.Component = () => { |
| 125 | |
| 126 | s.DEV?.registerGraph({value: {foo: 123}, name: 'my_custom_value'}) |
| 127 | |
| 128 | const [count, setCount] = s.createSignal(0) |
| 129 | const [showEven, setShowEven] = s.createSignal(false) |
| 130 | const fnSig = s.createSignal({fn: () => {}}, {equals: (a, b) => a.fn === b.fn}) |
| 131 | const nullSig = s.createSignal(null) |
| 132 | const symbolSig = s.createSignal(Symbol('hello-symbol')) |
| 133 | const [header, setHeader] = s.createSignal( |
| 134 | <h1 onClick={() => setHeader(<h1>Call that an easter egg</h1>)}>Welcome to the Sandbox</h1>, |
| 135 | ) |
| 136 | |
| 137 | // setInterval(() => { |
| 138 | // setCount(count() + 1) |
| 139 | // }, 2000) |
| 140 | |
| 141 | const objmemo = s.createMemo(() => { |
| 142 | return { |
| 143 | foo: 'bar', |
| 144 | count: count(), |
| 145 | get subheader() { |
| 146 | return <h2>Subheader</h2> |
| 147 | }, |
| 148 | } |
| 149 | }) |
| 150 | |
| 151 | s.createComputed(_ => { |
| 152 | const hello = s.createSignal('hello') |
| 153 | setShowEven(count() % 3 === 0) |
| 154 | return count() |
| 155 | }, undefined, {name: 'very-long-name-that-will-definitely-not-have-enough-space-to-render'}) |
| 156 | |
| 157 | s.createComputed(() => {}, undefined, {name: 'frozen'}) |
| 158 | s.createRenderEffect(() => {}) |
| 159 | |
| 160 | const Bold: s.ParentComponent = props => <b>{props.children}</b> |
| 161 | |
| 162 | const BoldWrapper = createComponent(() => <Bold>{count()} is even!</Bold>) |
| 163 | |
| 164 | const [showBroken, setShowBroken] = s.createSignal(false) |
| 165 | |
| 166 | return <> |
| 167 | {header()} |
| 168 | {objmemo().subheader} |
| 169 | <div> |
| 170 | <header> |
| 171 | <Button onClick={() => setCount(p => ++p)} text={`Count: ${count()}`} /> |
| 172 | <Button onClick={() => setCount(p => ++p)} text={`Count: ${count()}`} /> |
| 173 | </header> |
| 174 | <sweb.Dynamic |
| 175 | component='div' |
| 176 | style={{height: '1rem', 'margin-top': '1rem'}} |
| 177 | > |
| 178 | <s.Show when={showEven()} fallback={<span>Count is very odd</span>}> |
| 179 | {s.createComponent(() => <> |
| 180 | <BoldWrapper/> |
| 181 | </>, {})} |
nothing calls this directly
no test coverage detected