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

Function UseLocal

tsunami/engine/hooks.go:74–87  ·  view source on GitHub ↗
(vc *RenderContextImpl, initialVal any)

Source from the content-addressed store, hash-verified

72}
73
74func UseLocal(vc *RenderContextImpl, initialVal any) string {
75 hookVal := vc.getOrderedHook()
76 atomName := "$local." + vc.GetCompWaveId() + "#" + strconv.Itoa(hookVal.Idx)
77 if !hookVal.Init {
78 hookVal.Init = true
79 atom := MakeAtomImpl(initialVal, nil)
80 vc.Root.RegisterAtom(atomName, atom)
81 closedAtomName := atomName
82 hookVal.UnmountFn = func() {
83 vc.Root.RemoveAtom(closedAtomName)
84 }
85 }
86 return atomName
87}
88
89func UseVDomRef(vc *RenderContextImpl) any {
90 hookVal := vc.getOrderedHook()

Callers 1

UseLocalFunction · 0.92

Calls 5

MakeAtomImplFunction · 0.85
getOrderedHookMethod · 0.80
GetCompWaveIdMethod · 0.80
RegisterAtomMethod · 0.80
RemoveAtomMethod · 0.80

Tested by

no test coverage detected