Interface IDecider<C, S, E>

IDecider represents the main decision-making algorithm. It has three generic parameters C, S, E , representing the type of the values that IDecider may contain or use. IDecider can be specialized for any type C or S or E because these types does not affect its behavior. IDecider behaves the same for C=Int or C=YourCustomType, for example.

IDecider is a pure domain interface.

Param: decide

A function/lambda that takes command of type C and input state of type S as parameters, and returns/emits the list of output events E[]>

Param: evolve

A function/lambda that takes input state of type S and input event of type E as parameters, and returns the output/new state S

Param: initialState

A starting point / An initial state of type S

Author

Иван Дугалић / Ivan Dugalic /

Idugalic

interface IDecider<C, S, E> {
    decide: ((command, state) => readonly E[]);
    evolve: ((state, event) => S);
    initialState: S;
}

Type Parameters

  • C

    Command

  • S

    State

  • E

    Event

Hierarchy (view full)

Implemented by

Properties

decide: ((command, state) => readonly E[])

Type declaration

    • (command, state): readonly E[]
    • Parameters

      • command: C
      • state: S

      Returns readonly E[]

evolve: ((state, event) => S)

Type declaration

    • (state, event): S
    • Parameters

      • state: S
      • event: E

      Returns S

initialState: S

Generated using TypeDoc