makeStateKey
创建一个 StateKey<T>
,可用于把 T 类型的值存储在 TransferState
中。
Create a StateKey<T>
that can be used to store value of type T with TransferState
.
说明
例如:
Example:
const COUNTER_KEY = makeStateKey<number>('counter');
let value = 10;
transferState.set(COUNTER_KEY, value);