SimpleObjectMemory class

Simple implement of MemoryInterface

Constructors

SimpleObjectMemory(any)

Initializes a new instance of the SimpleObjectMemory class. This wraps a simple object as MemoryInterface.

Methods

getValue(string)

Gets the value from a given path.

setValue(string, any)

In this simple object scope, we don't allow you to set a path in which some parts in middle don't exist for example if you set dialog.a.b = x, but dialog.a don't exist, this will result in an error because we can't and shouldn't smart create structure in the middle you can implement a customzied Scope that support such behavior

toString()

Returns a string that represents the current SimpleObjectMemory object.

version()

Returns the version info of SimpleObjectMemory.

wrap(any)

Transfer a common object to simple memory.

Constructor Details

SimpleObjectMemory(any)

Initializes a new instance of the SimpleObjectMemory class. This wraps a simple object as MemoryInterface.

new SimpleObjectMemory(memory: any)

Parameters

memory

any

The object to wrap.

Method Details

getValue(string)

Gets the value from a given path.

function getValue(path: string): any

Parameters

path

string

Given path.

Returns

any

The value in the given path or undefined.

setValue(string, any)

In this simple object scope, we don't allow you to set a path in which some parts in middle don't exist for example if you set dialog.a.b = x, but dialog.a don't exist, this will result in an error because we can't and shouldn't smart create structure in the middle you can implement a customzied Scope that support such behavior

function setValue(path: string, input: any)

Parameters

path

string

Memory path.

input

any

Value to set.

toString()

Returns a string that represents the current SimpleObjectMemory object.

function toString(): string

Returns

string

A string value representing the current SimpleObjectMemory object.

version()

Returns the version info of SimpleObjectMemory.

function version(): string

Returns

string

A string value representing the version info.

wrap(any)

Transfer a common object to simple memory.

static function wrap(obj: any): MemoryInterface

Parameters

obj

any

Common object.

Returns

Simple memory instance.