Options
All
  • Public
  • Public/Protected
  • All
Menu

Represent a generic dictionarylike Manager. Used to save instances of objects that could be used more than once and shouldn't be created often.

Type parameters

  • T

Hierarchy

Index

Constructors

Properties

Accessors

Methods

Constructors

Protected constructor

  • Returns BaseManager

Properties

Private _values

_values: T[]

Saves the values for easier internal access.

keys

keys: string[]

Used to show the available keys in the Manager. Mostly used for import.

lookup

lookup: {}

Represents the store of the data.

Type declaration

  • [key: string]: T

Accessors

values

  • get values(): T[]
  • Returns all saved values.

    Returns T[]

Methods

add

  • add(key: string, value: T): void
  • Saves a value in the Manager. Overrides existing values of the key.

    Parameters

    • key: string

      The key of the value

    • value: T

      The value to be saved

    Returns void

addIfNotExists

  • addIfNotExists(key: string, value: T): void
  • Adds a value if it not already exists within the storage.

    Parameters

    • key: string

      The key of the value

    • value: T

      The value to be saved

    Returns void

exists

  • exists(key: string): boolean
  • Checks if a key exists in the storage.

    Parameters

    • key: string

      The key to be checked.

    Returns boolean

get

  • get(key: string): T | undefined
  • Returns the value of a key or undefined if the key not exists.

    Parameters

    • key: string

      The key of the value to be returned.

    Returns T | undefined

getOrAdd

  • getOrAdd(key: string, def: T): T
  • Checks for a key and returns its value or adds the default provided.

    Parameters

    • key: string

      The key of the value to be returned.

    • def: T

      Defaultvalue that should be added and returned, if the key not exists.

    Returns T

remove

  • remove(key: string): void
  • Removes a certain key from the storage.

    Parameters

    • key: string

      The key of the value to be removed.

    Returns void

Generated using TypeDoc