diff --git a/js_export.go b/js_export.go index 96a11e8..ab46d9a 100644 --- a/js_export.go +++ b/js_export.go @@ -8,18 +8,16 @@ import ( func init() { jsmod.Register("api", map[string]any{ - "call": call, - "setConfig": SetConfig, - "registerAction": RegisterAction, - "registerSigner": registerSigner, + "Call": call, + "SetConfig": SetConfig, + "RegisterAction": RegisterAction, + "RegisterSigner": registerSigner, }) } // call 提供给 JS 的私有入口 func call(ctx context.Context, name string, payload any) (any, error) { - // 注意:在低代码环境中,我们可能需要将 ctx 传入以透传追踪信息给 JS 签名器。 - // 虽然 api.CallBy[any] 目前不接收 ctx,但底层的 jsRunner 钩子可以从 context 中获取信息。 - // 如果未来 jsRunner 需要 ctx,我们可以在这里通过 context.WithValue 注入。 + // 将 ctx 传入以透传追踪信息给 JS 签名器 return CallBy[any](name, payload) }