类: MessageProcessor
有状态的 A2UI 协议处理器,将原始 v0.9 消息转换为可渲染的 surface、resource、数据模型 signal 以及用户操作事件。
构造函数
构造函数
new MessageProcessor():
MessageProcessor
返回
MessageProcessor
属性
surfaces
surfaces:
Map<string,Surface>
方法
clearSurfaces()
clearSurfaces():
void
返回
void
dispatch()
dispatch(
message:Record<string,unknown>):Promise<unknown>
参数
返回
Promise<unknown>
getOrCreateSurface()
getOrCreateSurface(
surfaceId:string):Surface
参数
返回
getSurfaces()
getSurfaces():
ReadonlyMap<string,Surface>
返回
ReadonlyMap<string, Surface>
onEvent()
onEvent(
callback: (event:A2UIEvent) =>void): () =>void
参数
返回
() => void
onUpdate()
onUpdate(
callback: (data:Record<string,unknown>) =>void): () =>void
参数
返回
() => void
processMessages()
processMessages(
messages:ServerToClientMessage[]):void
参数
返回
void
resolvePath()
resolvePath(
path:string,dataContextPath?:string):string
结合当前数据上下文解析 JSON Pointer。
- 绝对路径(以 '/' 开头)原样返回。
- 相对路径基于传入的 dataContextPath 解析。
参数
返回
string