Class BeatRepeat

The MsRepeat defines some action which should be performed on every update cycle for some amount of time, measured in beats.

Hierarchy

Constructors

  • Parameters

    • metronome: IMetronome

      The metronome used to count how many beats have passed.

    • beatCount: number

      How many beats the repetition should run for.

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

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

    Returns BeatRepeat

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 beatCount(): number
  • How many beats the repetition should run for.

    Returns number

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

    Returns boolean

  • get metronome(): IMetronome
  • The metronome used to count how many beats have passed.

    Returns IMetronome

  • 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