Type alias Service<S>

Service<S>: {
    onchange?: ((state: S) => any);
    run: ((cell: MeiosisCell<S>) => any);
}

A service gets called when the state changes and when the value returned by the onchange function has changed.

Type Parameters

  • S

    the State type.

Type declaration

  • Optional onchange?: ((state: S) => any)
      • (state: S): any
      • Function that gets called when the state changes. This function should return a value from the state. Only when that value changes will the service's run function be called.

        Parameters

        • state: S

        Returns any

  • run: ((cell: MeiosisCell<S>) => any)
      • (cell: MeiosisCell<S>): any
      • Function that gets called when the value returned by the onchange function has changed. The function should call cell.update(...) to update the state.

        Parameters

        Returns any

Generated using TypeDoc