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

Function UseVDomRef

tsunami/app/hooks.go:24–32  ·  view source on GitHub ↗

UseVDomRef provides a reference to a DOM element in the VDOM tree. It returns a VDomRef that can be attached to elements for direct DOM access. The ref will not be current on the first render - refs are set and become current after client-side mounting. This hook must be called within a component co

()

Source from the content-addressed store, hash-verified

22// current after client-side mounting.
23// This hook must be called within a component context.
24func UseVDomRef() *vdom.VDomRef {
25 rc := engine.GetGlobalRenderContext()
26 val := engine.UseVDomRef(rc)
27 refVal, ok := val.(*vdom.VDomRef)
28 if !ok {
29 panic("UseVDomRef hook value is not a ref (possible out of order or conditional hooks)")
30 }
31 return refVal
32}
33
34// TermRef wraps a VDomRef and implements io.Writer by forwarding writes to the terminal.
35type TermRef struct {

Callers 1

UseTermRefFunction · 0.70

Calls 2

GetGlobalRenderContextFunction · 0.92
UseVDomRefFunction · 0.92

Tested by

no test coverage detected