SimpleObjectMemory class

简单实现 MemoryInterface

构造函数

SimpleObjectMemory(any)

初始化 SimpleObjectMemory 类的新实例。 这会将简单对象包装为 MemoryInterface

方法

getValue(string)

从给定路径获取值。

setValue(string, any)

在此简单对象作用域中,我们不允许设置一个路径,例如,如果设置了 dialog.a.b = x,但 dialog.a 不存在,这将导致错误,因为我们不能并且不应该在中间智能创建结构,你可以实现支持此类行为的自定义作用域

toString()

返回一个字符串,表示当前 SimpleObjectMemory 对象。

version()

返回 SimpleObjectMemory的版本信息。

wrap(any)

将通用对象传输到简单内存。

构造函数详细信息

SimpleObjectMemory(any)

初始化 SimpleObjectMemory 类的新实例。 这会将简单对象包装为 MemoryInterface

new SimpleObjectMemory(memory: any)

参数

memory

any

要包装的对象。

方法详细信息

getValue(string)

从给定路径获取值。

function getValue(path: string): any

参数

path

string

给定路径。

返回

any

给定路径或未定义中的值。

setValue(string, any)

在此简单对象作用域中,我们不允许设置一个路径,例如,如果设置了 dialog.a.b = x,但 dialog.a 不存在,这将导致错误,因为我们不能并且不应该在中间智能创建结构,你可以实现支持此类行为的自定义作用域

function setValue(path: string, input: any)

参数

path

string

内存路径。

input

any

要设置的值。

toString()

返回一个字符串,表示当前 SimpleObjectMemory 对象。

function toString(): string

返回

string

表示当前 SimpleObjectMemory 对象的字符串值。

version()

返回 SimpleObjectMemory的版本信息。

function version(): string

返回

string

一个表示版本信息的字符串值。

wrap(any)

将通用对象传输到简单内存。

static function wrap(obj: any): MemoryInterface

参数

obj

any

通用对象。

返回

简单内存实例。