MCPcopy
hub / github.com/dosco/graphjin / fromMember

Function fromMember

wasm/query.go:159–177  ·  view source on GitHub ↗
(m *core.Member)

Source from the content-addressed store, hash-verified

157}
158
159func fromMember(m *core.Member) map[string]interface{} {
160 dataFn := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
161 if len(args) == 0 || args[0].Type() != js.TypeFunction {
162 err := errors.New("callback argument missing")
163 return toJSError(err)
164 }
165 cb := args[0]
166 go func() {
167 for {
168 msg := <-m.Result
169 cb.Invoke(fromResult(msg))
170 }
171 }()
172 return nil
173 })
174 return map[string]interface{}{
175 "data": dataFn,
176 }
177}

Callers 2

subscribeFunction · 0.85
subscribeByNameFunction · 0.85

Calls 2

toJSErrorFunction · 0.85
fromResultFunction · 0.85

Tested by

no test coverage detected