跳到主要内容

compileState 编译状态对象

compileState

类型: MethodDeclaration

所属类: CommandFunctionList

定义位置: command.ts

描述

编译状态对象

参数 state: 状态访问器

返回值:状态访问器函数

参数

参数名类型描述默认值
stateStateGetter--

返回值

类型: () => State \| undefined

状态访问器函数

源代码

位置: 第 544 行

public compileState(state: StateGetter): () => State | undefined {
switch (state.type) {
case 'trigger':
return () => CurrentEvent.triggerState
case 'latest':
return () => State.latest
case 'by-id': {
const getActor = Command.compileActor(state.actor)
return () => getActor()?.state.get(state.stateId)
}
case 'variable':
return Command.compileVariable(state.variable, Attribute.STATE_GET)
}
}

文档生成时间:2025/7/7 12:07:06