Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GatewayStore

Hierarchy

  • Cache<string, Gateway>
    • GatewayStore

Index

Constructors

constructor

Properties

Readonly client

client: Client

The client this GatewayDriver was created with.

since

0.6.0

Readonly size

size: number

Accessors

first

  • get first(): [string, Gateway] | null
  • The first item in this Cache

    Returns [string, Gateway] | null

firstKey

  • get firstKey(): string | null
  • The first key of this cache

    Returns string | null

firstValue

last

  • get last(): [string, Gateway] | null
  • The last item in this cache

    Returns [string, Gateway] | null

lastKey

  • get lastKey(): string | null
  • The last key of this cache

    Returns string | null

lastValue

Methods

clear

  • clear(): void
  • Returns void

clone

  • Returns a shallow clone of this Cache

    Returns Cache<string, Gateway>

concat

  • Returns a new Cache with this and other caches together

    Parameters

    • Rest ...caches: Cache<string, Gateway>[]

      Other caches to include in the new cache

    Returns Cache<string, Gateway>

delete

  • delete(key: string): boolean
  • Parameters

    • key: string

    Returns boolean

equals

  • equals(cache: Cache<string, Gateway>): boolean
  • Naive equality compare function

    Parameters

    • cache: Cache<string, Gateway>

      The cache to compare this against

    Returns boolean

every

  • every(fn: (value: Gateway, key: string, map: this) => boolean, thisArg?: any): boolean
  • Tests if every entry in this cache meets a condition

    Parameters

    • fn: (value: Gateway, key: string, map: this) => boolean

      The function to test the condition

        • (value: Gateway, key: string, map: this): boolean
        • Parameters

          • value: Gateway
          • key: string
          • map: this

          Returns boolean

    • Optional thisArg: any

      Optional binding for the fn param

    Returns boolean

filter

  • filter(fn: (value: Gateway, key: string, map: this) => boolean, thisArg?: any): Cache<string, Gateway>
  • Returns a new filtered Cache based on the filter function

    Parameters

    • fn: (value: Gateway, key: string, map: this) => boolean

      Function used to determine what entries are in the new Cache

        • (value: Gateway, key: string, map: this): boolean
        • Parameters

          • value: Gateway
          • key: string
          • map: this

          Returns boolean

    • Optional thisArg: any

      Optional binding for the fn param

    Returns Cache<string, Gateway>

find

  • find(fn: (value: Gateway, key: string, map: this) => boolean, thisArg?: any): [string, Gateway] | undefined
  • Finds an entry from this Cache

    Parameters

    • fn: (value: Gateway, key: string, map: this) => boolean

      Function used to find what you are looking for

        • (value: Gateway, key: string, map: this): boolean
        • Parameters

          • value: Gateway
          • key: string
          • map: this

          Returns boolean

    • Optional thisArg: any

      Optional binding for the fn param

    Returns [string, Gateway] | undefined

findKey

  • findKey(fn: (value: Gateway, key: string, map: this) => boolean, thisArg?: any): string | undefined
  • Finds a key from this Cache

    Parameters

    • fn: (value: Gateway, key: string, map: this) => boolean

      Function used to find what you are looking for

        • (value: Gateway, key: string, map: this): boolean
        • Parameters

          • value: Gateway
          • key: string
          • map: this

          Returns boolean

    • Optional thisArg: any

      Optional binding for the fn param

    Returns string | undefined

findValue

  • findValue(fn: (value: Gateway, key: string, map: this) => boolean, thisArg?: any): Gateway | undefined
  • Finds a value from this Cache

    Parameters

    • fn: (value: Gateway, key: string, map: this) => boolean

      Function used to find what you are looking for

        • (value: Gateway, key: string, map: this): boolean
        • Parameters

          • value: Gateway
          • key: string
          • map: this

          Returns boolean

    • Optional thisArg: any

      Optional binding for the fn param

    Returns Gateway | undefined

forEach

  • forEach(callbackfn: (value: Gateway, key: string, map: Map<string, Gateway>) => void, thisArg?: any): void
  • Parameters

    Returns void

get

  • get(key: string): Gateway | undefined
  • Parameters

    • key: string

    Returns Gateway | undefined

has

  • has(key: string): boolean
  • Parameters

    • key: string

    Returns boolean

init

  • init(): Promise<void>

map

  • map<T>(fn: (value: Gateway, key: string, map: this) => T, thisArg?: any): T[]
  • Maps this Cache to an array (like Array#map())

    Type parameters

    • T

    Parameters

    • fn: (value: Gateway, key: string, map: this) => T

      Function to determine what is mapped to the new Array

        • (value: Gateway, key: string, map: this): T
        • Parameters

          • value: Gateway
          • key: string
          • map: this

          Returns T

    • Optional thisArg: any

      Optional binding for the fn param

    Returns T[]

reduce

  • reduce<I>(fn: (accumulator: I, value: Gateway, key: string, map: this) => I, initialValue: I, thisArg?: any): I
  • Reduces this cache into a singularity

    Type parameters

    • I

    Parameters

    • fn: (accumulator: I, value: Gateway, key: string, map: this) => I

      The function to determine how this Cache is reduced

        • (accumulator: I, value: Gateway, key: string, map: this): I
        • Parameters

          • accumulator: I
          • value: Gateway
          • key: string
          • map: this

          Returns I

    • initialValue: I

      The initial value

    • Optional thisArg: any

      Optional binding for the fn param

    Returns I

register

  • Registers a new gateway.

    example

    // Import Client and Gateway from klasa const { Client, Gateway } = require('klasa');

    // Construct the client and register a gateway named channels const client = new Client(); client.register(new Gateway(client, 'channels'));

    example

    // Import Client and Gateway from klasa const { Client, Gateway } = require('klasa'); const client = new Client();

    // register calls can be chained client .register(new Gateway(client, 'channels')) .register(new Gateway(client, 'moderations', { provider: 'postgres' }));

    Parameters

    • gateway: Gateway

      The gateway to register

    Returns this

set

  • set(key: string, value: Gateway): this
  • Parameters

    Returns this

some

  • some(fn: (value: Gateway, key: string, map: this) => boolean, thisArg?: any): boolean
  • Tests if some entries in this cache meets a condition

    Parameters

    • fn: (value: Gateway, key: string, map: this) => boolean

      The function to test the condition

        • (value: Gateway, key: string, map: this): boolean
        • Parameters

          • value: Gateway
          • key: string
          • map: this

          Returns boolean

    • Optional thisArg: any

      Optional binding for the fn param

    Returns boolean

sort

  • sort(compareFunction?: undefined | ((v0: Gateway, v1: Gateway, k0?: K, k1?: K) => number)): this
  • Sorts entries in-place in this Cache

    Parameters

    • Optional compareFunction: undefined | ((v0: Gateway, v1: Gateway, k0?: K, k1?: K) => number)

      Function to determine how this Cache should be sorted

    Returns this

sorted

  • sorted(compareFunction?: undefined | ((v0: Gateway, v1: Gateway, k0?: K, k1?: K) => number)): Cache<string, Gateway>
  • Sorts entries in a new Cache

    Parameters

    • Optional compareFunction: undefined | ((v0: Gateway, v1: Gateway, k0?: K, k1?: K) => number)

      Function to determine how the resulting Cache should be sorted

    Returns Cache<string, Gateway>

sweep

  • sweep(fn: (value: Gateway, key: string, map: this) => boolean, thisArg?: any): number
  • Sweeps entries from this Cache

    Parameters

    • fn: (value: Gateway, key: string, map: this) => boolean

      Function used to determine what entries are swept

        • (value: Gateway, key: string, map: this): boolean
        • Parameters

          • value: Gateway
          • key: string
          • map: this

          Returns boolean

    • Optional thisArg: any

      Optional binding for the fn param

    Returns number

toJSON

Generated using TypeDoc