Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DefaultMusicHandler

Hierarchy

Implements

Index

Constructors

constructor

Properties

Protected cursor

cursor: number

Protected default

default: number | (() => number)

Protected enumObject

enumObject: any

Readonly event

event: IEventEmitter<this, IEnumCursorEvents<Music>> = new EventEmitter<this, E>(this)

Protected values

values: Music[]

Methods

filter

  • filter(filter: (name: string, value: Music) => boolean): this
  • Filters the valid enum entries. This causes the internal list of enum entries to be refreshed. If the cursor has been set previously, it will likely be moved to a different entry.

    Parameters

    • filter: (name: string, value: Music) => boolean

      A function that takes a name and enum value and returns whether the entry should be included.

        • (name: string, value: Music): boolean
        • Parameters

          • name: string
          • value: Music

          Returns boolean

    Returns this

get

  • get(): E
  • Returns the entry at the cursor position.

    Returns E

getRandomPosition

  • getRandomPosition(): number
  • Retrieves a random cursor position

    Returns number

move

  • move(amt: number): Music
  • If the given amount is positive, moves forward that many entries. If the given amount is negative, moves backward that many entries.

    Parameters

    • amt: number

    Returns Music

    The entry at the new cursor position.

moveTo

  • moveTo(n: number): this
  • Sets the cursor position.

    Parameters

    • n: number

    Returns this

moveToDefault

  • Moves to the default cursor position.

    Returns Music

moveToEnumEntry

  • Sets the cursor position to the position of this enum entry in the filtered list.

    Parameters

    Returns Music

    The entry at the new cursor position.

moveToRandom

  • Moves the cursor to a random entry, then returns that entry.

    Returns Music

next

previous

  • Moves the cursor backward one entry, and returns the new entry.

    Returns Music

refresh

  • refresh(): this
  • Refreshes the internal list of enum entries. If the full enumeration has changed, the cursor may be moved to a different entry.

    Returns this

setDefault

  • setDefault(n: number): this
  • setDefault(generator: () => number): this
  • setDefault(defaultGenerator: EnumCursorDefaultGenerator): this
  • Sets the default cursor position.

    Parameters

    • n: number

    Returns this

  • Sets a handler for retrieving the default cursor position.

    Parameters

    • generator: () => number
        • (): number
        • Returns number

    Returns this

  • Sets a handler for retrieving the default cursor position to a pre-implemented method by EnumCursorDefaultGenerator entry.

    Parameters

    Returns this

setDefaultToEntry

  • setDefaultToEntry(entry: Music): this
  • Sets the default cursor position to the position of the given entry in this cursor.

    Parameters

    Returns this

Generated using TypeDoc