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

Method CreateVDomContext

pkg/waveapp/waveapp.go:199–227  ·  view source on GitHub ↗
(target *vdom.VDomTarget)

Source from the content-addressed store, hash-verified

197}
198
199func (c *Client) CreateVDomContext(target *vdom.VDomTarget) error {
200 blockORef, err := wshclient.VDomCreateContextCommand(
201 c.RpcClient,
202 vdom.VDomCreateContext{Target: target},
203 &wshrpc.RpcOpts{Route: wshutil.MakeFeBlockRouteId(c.RpcContext.BlockId)},
204 )
205 if err != nil {
206 return err
207 }
208 c.VDomContextBlockId = blockORef.OID
209 log.Printf("created vdom context: %v\n", blockORef)
210 gotRoute, err := wshclient.WaitForRouteCommand(c.RpcClient, wshrpc.CommandWaitForRouteData{
211 RouteId: wshutil.MakeFeBlockRouteId(blockORef.OID),
212 WaitMs: 4000,
213 }, &wshrpc.RpcOpts{Timeout: 5000})
214 if err != nil {
215 return fmt.Errorf("error waiting for vdom context route: %v", err)
216 }
217 if !gotRoute {
218 return fmt.Errorf("vdom context route could not be established")
219 }
220 wshclient.EventSubCommand(c.RpcClient, wps.SubscriptionRequest{Event: wps.Event_BlockClose, Scopes: []string{
221 blockORef.String(),
222 }}, nil)
223 c.RpcClient.EventListener.On("blockclose", func(event *wps.WaveEvent) {
224 c.doShutdown("got blockclose event")
225 })
226 return nil
227}
228
229func (c *Client) SendAsyncInitiation() error {
230 if c.VDomContextBlockId == "" {

Callers 1

runMainEMethod · 0.95

Implementers 1

WshRouterpkg/wshutil/wshrouter.go

Calls 7

doShutdownMethod · 0.95
VDomCreateContextCommandFunction · 0.92
MakeFeBlockRouteIdFunction · 0.92
WaitForRouteCommandFunction · 0.92
EventSubCommandFunction · 0.92
OnMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected