Skip to content

Latest commit

 

History

History
275 lines (157 loc) · 6.1 KB

condition.md

File metadata and controls

275 lines (157 loc) · 6.1 KB

selenidejsCondition

Class: Condition <E>

Like Command, i.e. can pass or fail with Error. It is defined as separate type alias to differentiate the usage scenarios. Conditions we use in context of matching condition on entity. Condition is like a predicate but instead of (true | false) you get (passed | throws Error)

Read "void" in Query<T, void> as "matched", or "passed".

Type parameters

E

Hierarchy

  • Condition

Implements

  • Fn‹E, void›

Index

Constructors

Properties

Methods

Constructors

constructor

+ new Condition(description: any, fn: any): Condition

Defined in lib/wait.ts:75

Parameters:

Name Type
description any
fn any

Returns: Condition

Properties

Private description

description: string

Defined in lib/wait.ts:74


Private fn

fn: Lambda‹E, void›

Defined in lib/wait.ts:75

Methods

and

and(condition: Condition‹E›): any

Defined in lib/wait.ts:86

Parameters:

Name Type
condition Condition‹E›

Returns: any


call

call(entity: E): Promise‹void›

Implementation of Fn

Defined in lib/wait.ts:82

Parameters:

Name Type
entity E

Returns: Promise‹void›


or

or(condition: Condition‹E›): Condition‹E›

Defined in lib/wait.ts:90

Parameters:

Name Type
condition Condition‹E›

Returns: Condition‹E›


toString

toString(): string

Defined in lib/wait.ts:94

Returns: string


Static all

all<T>(...conditions: Condition‹T›[]): Condition‹T›

Defined in lib/wait.ts:161

Transforms conditions array provided as varargs to condition by applying Condition.and

Type parameters:

T

Parameters:

Name Type
...conditions Condition‹T›[]

Returns: Condition‹T›


Static allNot

allNot<T>(...conditions: Condition‹T›[]): Condition‹T›

Defined in lib/wait.ts:176

Transforms conditions array provided as varargs to condition by applying Condition.and

Type parameters:

T

Parameters:

Name Type
...conditions Condition‹T›[]

Returns: Condition‹T›


Static and

and<T>(...conditions: Condition‹T›[]): Condition‹T›

Defined in lib/wait.ts:130

Combines conditions by logical AND

Type parameters:

T

Parameters:

Name Type
...conditions Condition‹T›[]

Returns: Condition‹T›


Static asPredicate

asPredicate<T>(...conditions: Condition‹T›[]): (Anonymous function)

Defined in lib/wait.ts:193

Transforms Conditions (returning (void | throws Error)), combined by AND if more than one, to async Predicate (returning (true | false))

Type parameters:

T

Parameters:

Name Type
...conditions Condition‹T›[]

Returns: (Anonymous function)


Static not

not<T>(condition: Condition‹T›, description?: string): Condition‹T›

Defined in lib/wait.ts:109

Negates condition. Making the negated condition to:

  • pass (return void) in case original condition would throw Error
  • throw Error in case original condition would pass (return void)

Type parameters:

T

Parameters:

Name Type Description
condition Condition‹T› original condition to be negated
description? string custom description if "not " version is not enough

Returns: Condition‹T›


Static or

or<T>(...conditions: Condition‹T›[]): Condition‹T›

Defined in lib/wait.ts:142

Combines conditions by logical OR

Type parameters:

T

Parameters:

Name Type
...conditions Condition‹T›[]

Returns: Condition‹T›