mpc-js
    Preparing search index...

    Class MPC

    Hierarchy

    • MPCCore
      • MPC
    Index

    Constructors

    Properties

    clientToClient: ClientToClientCommands
    connection: ConnectionCommands
    currentPlaylist: CurrentPlaylistCommands
    mpdVersion?: [number, number, number]

    The version (major, minor, patch) of the connected daemon

    outputDevices: OutputDeviceCommands
    playbackOptions: PlaybackOptionsCommands
    reflection: ReflectionCommands
    stickers: StickerCommands
    storedPlaylists: StoredPlaylistsCommands
    prefixed: string | boolean

    Accessors

    Methods

    • Type Parameters

      • T extends string | symbol

      Parameters

      • event: T
      • fn: (...args: any[]) => void
      • Optionalcontext: any

      Returns this

    • Parameters

      • url: string

      Returns Promise<void>

    • Disconnect from the daemon

      Parameters

      • err: { errorCode: number; errorMessage: string } = ...

      Returns void

    • Calls each of the listeners registered for a given event.

      Type Parameters

      • T extends string | symbol

      Parameters

      • event: T
      • ...args: any[]

      Returns boolean

    • Return an array listing the events for which the emitter has registered listeners.

      Returns (string | symbol)[]

    • Return the number of listeners listening to a given event.

      Parameters

      • event: string | symbol

      Returns number

    • Return the listeners registered for a given event.

      Type Parameters

      • T extends string | symbol

      Parameters

      • event: T

      Returns ((...args: any[]) => void)[]

    • Type Parameters

      • T extends string | symbol

      Parameters

      • event: T
      • Optionalfn: (...args: any[]) => void
      • Optionalcontext: any
      • Optionalonce: boolean

      Returns this

    • Add a listener for a given event.

      Type Parameters

      • T extends string | symbol

      Parameters

      • event: T
      • fn: (...args: any[]) => void
      • Optionalcontext: any

      Returns this

    • Add a one-time listener for a given event.

      Type Parameters

      • T extends string | symbol

      Parameters

      • event: T
      • fn: (...args: any[]) => void
      • Optionalcontext: any

      Returns this

    • Helper function for parsing a response from the daemon into an array of objects

      Type Parameters

      • T

      Parameters

      • lines: string[]

        The daemon response

      • markers: string[]

        Markers are keys denoting the start of a new object within the response

      • convert: (valueMap: Map<string, string>) => T

        Converts a key-value Map from the response into the desired target object

      Returns T[]

    • Type Parameters

      • T

      Parameters

      • lines: string[]
      • groupingTag: undefined | string

      Returns Map<string, string[]>

    • Remove all listeners, or those of the specified event.

      Parameters

      • Optionalevent: string | symbol

      Returns this

    • Remove the listeners of a given event.

      Type Parameters

      • T extends string | symbol

      Parameters

      • event: T
      • Optionalfn: (...args: any[]) => void
      • Optionalcontext: any
      • Optionalonce: boolean

      Returns this

    • Send a command to the daemon. The returned promise will be resolved with an array containing the lines of the daemon's response.

      Parameters

      • cmd: string

      Returns Promise<MPDResponse>