OnCondition class

Actions triggered when condition is true.

Extends

Configurable

Constructors

OnCondition(string, Dialog[])

Create a new OnCondition instance.

Properties

$kind
actions

Gets or sets the actions to add to the plan when the rule constraints are met.

condition

Gets or sets the condition which needs to be met for the actions to be executed (OPTIONAL).

id

Id for condition.

priority

Get or sets the rule priority expression where 0 is the highest and less than 0 is ignored.

runOnce

A value indicating whether rule should only run once per unique set of memory paths.

Methods

addExternalCondition(string)

Add external condition to the OnCondition

currentPriority(ActionContext)

Compute the current value of the priority expression and return it.

execute(ActionContext)

Method called to execute the condition's actions.

getConverter(Object)
getDependencies()

Get child dialog dependencies so they can be added to the containers dialogset.

getExpression()

Get the cached expression for this condition.

Inherited Methods

configure(Record<string, unknown>)

Fluent method for configuring the object.

Constructor Details

OnCondition(string, Dialog[])

Create a new OnCondition instance.

new OnCondition(condition?: string, actions?: Dialog[])

Parameters

condition

string

(Optional) The condition which needs to be met for the actions to be executed.

actions

Dialog[]

(Optional) The actions to add to the plan when the rule constraints are met.

Property Details

$kind

static $kind: string

Property Value

string

actions

Gets or sets the actions to add to the plan when the rule constraints are met.

actions: Dialog[]

Property Value

Dialog[]

condition

Gets or sets the condition which needs to be met for the actions to be executed (OPTIONAL).

condition: BoolExpression

Property Value

BoolExpression

id

Id for condition.

id: string

Property Value

string

priority

Get or sets the rule priority expression where 0 is the highest and less than 0 is ignored.

priority: NumberExpression

Property Value

NumberExpression

runOnce

A value indicating whether rule should only run once per unique set of memory paths.

runOnce: boolean

Property Value

boolean

Method Details

addExternalCondition(string)

Add external condition to the OnCondition

function addExternalCondition(condition: string)

Parameters

condition

string

External constraint to add, it will be AND'ed to all other constraints.

currentPriority(ActionContext)

Compute the current value of the priority expression and return it.

function currentPriority(actionContext: ActionContext): number

Parameters

actionContext
ActionContext

Context to use for evaluation.

Returns

number

Computed priority.

execute(ActionContext)

Method called to execute the condition's actions.

function execute(actionContext: ActionContext): Promise<ActionChangeList[]>

Parameters

actionContext
ActionContext

Context.

Returns

Promise<ActionChangeList[]>

A promise with plan change list.

getConverter(Object)

function getConverter(property: Object): Converter | ConverterFactory

Parameters

property

Object

The key of the conditional selector configuration.

Returns

Converter | ConverterFactory

The converter for the selector configuration.

getDependencies()

Get child dialog dependencies so they can be added to the containers dialogset.

function getDependencies(): Dialog[]

Returns

Dialog[]

A list of Dialog.

getExpression()

Get the cached expression for this condition.

function getExpression(): Expression

Returns

Expression

Cached expression used to evaluate this condition.

Inherited Method Details

configure(Record<string, unknown>)

Fluent method for configuring the object.

function configure(config: Record<string, unknown>): this

Parameters

config

Record<string, unknown>

Configuration settings to apply.

Returns

this

The Configurable after the operation is complete.

Inherited From Configurable.configure