Class ConditionalRepeat

The ConditionalRepeat defines some action which should be performed on every update cycle until some condition has been met.

Hierarchy

  • RepeatBase<RepeatArgs>

    Hierarchy

    • ConditionalRepeat

Constructors

  • Parameters

    • condition: (() => boolean)

      The condition which must be satisfied for the repeat to automatically finish.

        • (): boolean
        • Returns boolean

    • action: ((args: RepeatArgs) => void)

      The action to perform for every update that the repeat is active.

    Returns ConditionalRepeat

Accessors

  • get action(): ((args: TArgs) => void)
  • The action to perform for every update that the repeat is active.

    Returns ((args: TArgs) => void)

      • (args: TArgs): void
      • The action to perform for every update that the repeat is active.

        Parameters

        • args: TArgs

        Returns void

  • get condition(): (() => boolean)
  • The condition which must be satisfied for the repeat to automatically finish.

    Returns (() => boolean)

      • (): boolean
      • The condition which must be satisfied for the repeat to automatically finish.

        Returns boolean

  • get isFinished(): boolean
  • Signifies whether the Repeat has stopped.

    Returns boolean

  • get ref(): string
  • Provides a way of identifying repeats so they can be easily retrieved later.

    Returns string

  • set ref(value: string): void
  • Parameters

    • value: string

    Returns void

  • get typeName(): string
  • Returns the name of this type. This can be used rather than instanceof which is sometimes unreliable.

    Returns string

Methods

  • Calling this tells the Repeat to stop whatever it's doing and that it will no longer be used.

    Returns void

  • This method is intended to be called by a clock to provide regular updates. It should be called by consumers of the library.

    Parameters

    • deltaMs: number

      How many milliseconds have passed since the last update cycle.

    Returns void

  • Provides a way for setting the ref through a chained function call. For example:

    clock.addChild(Repeat.forMs(100, console.log('Hello!')).withRef('repeat'));
    

    Returns

    The calling object.

    Parameters

    • ref: string

      The ref to set on the object.

    Returns IClockChild

Generated using TypeDoc