Compare commits

..

No commits in common. "main" and "v1.5.2" have entirely different histories.
main ... v1.5.2

View File

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