MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / Page

Function Page

pkg/vdom/vdom_test.go:22–42  ·  view source on GitHub ↗
(ctx context.Context, props map[string]any)

Source from the content-addressed store, hash-verified

20}
21
22func Page(ctx context.Context, props map[string]any) any {
23 clicked, setClicked := UseState(ctx, false)
24 var clickedDiv *VDomElem
25 if clicked {
26 clickedDiv = Bind(`<div>clicked</div>`, nil)
27 }
28 clickFn := func() {
29 log.Printf("run clickFn\n")
30 setClicked(true)
31 }
32 return Bind(
33 `
34<div>
35 <h1>hello world</h1>
36 <Button onClick="#param:clickFn">hello</Button>
37 <bindparam key="clickedDiv"/>
38</div>
39`,
40 map[string]any{"clickFn": clickFn, "clickedDiv": clickedDiv},
41 )
42}
43
44func Button(ctx context.Context, props map[string]any) any {
45 ref := UseVDomRef(ctx)

Callers

nothing calls this directly

Calls 2

UseStateFunction · 0.85
BindFunction · 0.85

Tested by

no test coverage detected