MCPcopy
hub / github.com/livebud/bud / render

Function render

framework/view/ssr/ssr_test.go:127–141  ·  view source on GitHub ↗
(vm js.VM, code, path string, props interface{})

Source from the content-addressed store, hash-verified

125}
126
127func render(vm js.VM, code, path string, props interface{}) (*ssr.Response, error) {
128 input, err := json.Marshal(props)
129 if err != nil {
130 return nil, err
131 }
132 result, err := vm.Eval("render.js", string(code)+`; bud.render("`+path+`", `+string(input)+`)`)
133 if err != nil {
134 return nil, err
135 }
136 var res ssr.Response
137 if err = json.Unmarshal([]byte(result), &res); err != nil {
138 return nil, err
139 }
140 return &res, nil
141}
142
143func TestSvelteProps(t *testing.T) {
144 is := is.New(t)

Callers 2

TestSveltePropsFunction · 0.70
TestSvelteLocalImportsFunction · 0.70

Calls 2

UnmarshalMethod · 0.80
EvalMethod · 0.65

Tested by

no test coverage detected