Class ClassCollection<T, V>

Generic class collection backed by store

Type Parameters

  • T

  • V

Hierarchy

Constructors

Properties

#objects: ReactiveMap<string, T> = ...
#storage: ObjectStorage<V> = ...
client: Client
getUnderlyingObject: ((id) => V)

Type declaration

    • (id): V
    • Parameters

      • id: string

      Returns V

updateUnderlyingObject: SetStoreFunction<Record<string, V>>

Methods

  • Create a new instance of an object

    Parameters

    • id: string

      Id

    • type: "user" | "server" | "channel" | "bot" | "channelUnread" | "channelWebhook" | "emoji" | "message" | "serverMember" | "session"

      Type

    • instance: T

      Instance

    • context: unknown

      Context

    • Optional data: unknown

      Data

    Returns void

  • Filter the collection by a given predicate

    Parameters

    • predicate: ((value, key) => boolean)

      Predicate to satisfy

        • (value, key): boolean
        • Parameters

          • value: T
          • key: string

          Returns boolean

    Returns T[]

  • Find some value based on a predicate

    Parameters

    • predicate: ((value, key) => boolean)

      Predicate to satisfy

        • (value, key): boolean
        • Parameters

          • value: T
          • key: string

          Returns boolean

    Returns undefined | T

  • Execute a provided function over each key, value pair in the map

    Parameters

    • cb: ((value, key, map) => void)

      Callback for each pair

        • (value, key, map): void
        • Parameters

          • value: T
          • key: string
          • map: ReactiveMap<string, T>

          Returns void

    Returns void

    Iterable

  • Map the collection using a given callback

    Type Parameters

    • O

    Parameters

    • cb: ((value, key) => O)

      Callback

        • (value, key): O
        • Parameters

          • value: T
          • key: string

          Returns O

    Returns O[]

Generated using TypeDoc