Skip to main content

Class: GuardBuilder

Defined in: src/interaction/StateMachine.ts:94

Builds a Guard for one input. Returned by when.

Example​

when('hovering').isTrue();
when('speed').greaterThan(10);
when('click').onTrigger();

Constructors​

Constructor​

new GuardBuilder(_name): GuardBuilder

Defined in: src/interaction/StateMachine.ts:95

Parameters​

_name​

string

Returns​

GuardBuilder

Methods​

atLeast()​

atLeast(value): Guard

Defined in: src/interaction/StateMachine.ts:141

Match when the number input is greater than or equal to value.

Parameters​

value​

number

Returns​

Guard


atMost()​

atMost(value): Guard

Defined in: src/interaction/StateMachine.ts:152

Match when the number input is less than or equal to value.

Parameters​

value​

number

Returns​

Guard


equals()​

equals(value): Guard

Defined in: src/interaction/StateMachine.ts:114

Match when the number input equals value.

Parameters​

value​

number

Returns​

Guard


greaterThan()​

greaterThan(value): Guard

Defined in: src/interaction/StateMachine.ts:119

Match when the number input is strictly greater than value.

Parameters​

value​

number

Returns​

Guard


is()​

is(value): Guard

Defined in: src/interaction/StateMachine.ts:98

Match when the input equals value (bool or number).

Parameters​

value​

InputValue

Returns​

Guard


isFalse()​

isFalse(): Guard

Defined in: src/interaction/StateMachine.ts:109

Match when the bool input is false.

Returns​

Guard


isTrue()​

isTrue(): Guard

Defined in: src/interaction/StateMachine.ts:104

Match when the bool input is true.

Returns​

Guard


lessThan()​

lessThan(value): Guard

Defined in: src/interaction/StateMachine.ts:130

Match when the number input is strictly less than value.

Parameters​

value​

number

Returns​

Guard


onTrigger()​

onTrigger(): Guard

Defined in: src/interaction/StateMachine.ts:163

Match when the trigger input is pending for this evaluation.

Returns​

Guard