bind
go
import "github.com/tangoui/tango/bind"本页由
site/tools/apigen从源码注释生成(按 darwin 构建标签选文件),请勿手改。
Package bind exposes the exported methods of a Go value as ipc calls named "Name.Method" using reflection.
Supported method shapes: an optional leading context.Context, then any number of JSON-decodable parameters (a variadic final parameter is allowed), returning nothing, (T), (error) or (T, error). JS passes the parameters positionally: tango.call("Greeter.Hello", "world").
函数
func Register
go
func Register(r *ipc.Router, name string, svc any) errorRegister binds every exported method of svc under name. It fails, binding nothing, if any exported method has an unsupported signature or svc has no exported methods. Methods are taken from svc's method set, so pass a pointer to include pointer-receiver methods.