An in-memory implementation of the Gadgets API Prefs interface, used when no player is attached — a local dev server, CMS preview, or a test.

Getter semantics match the player: an unset preference reads as '', false, 0, or [] rather than throwing. Unlike the player's implementation it tracks existence exactly, so MockPrefs.has distinguishes an unset preference from one set to an empty string.

Implements

  • IPrefsSource

Constructors

Methods

  • Parameters

    • key: string

    Returns string[]

  • Parameters

    • key: string

    Returns boolean

  • Returns string

  • Parameters

    • key: string

    Returns number

  • Parameters

    • key: string

    Returns number

  • Returns string

  • Returns string | number

  • Parameters

    • key: string

    Returns string

  • Parameters

    • key: string

    Returns string

  • Parameters

    • key: string

    Returns boolean

  • Parameters

    • key: string
    • val: any

    Returns void

  • Parameters

    • key: string
    • val: any[]

    Returns void