Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AdvancedManager<K, V>

A tweak to the Manager class that makes it self aware of the App class it's instantiated in

Type parameters

Hierarchy

Index

Constructors

constructor

Properties

app

app: IApp

The App the AdvancedManager is attached to

config

config: ICONFIG

The Config of the App the AdvancedManager is attached to

emitter

emitter: EventEmitter

The EventEmitter of the App the AdvancedManager is attached to

map

map: Map<K, V>

For backward compatability and performance reasons Manager use Map to store data

Accessors

length

  • get length(): number
  • An alias for size

    Returns number

size

  • get size(): number
  • Returns the total number of items stored in the Manager

    Returns number

Methods

[iterator]

  • [iterator](): IterableIterator<[K, V]>

add

  • Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers

    Parameters

    • value: V

    Returns Manager<K, V>

clear

  • Clear the Manager of all its contents

    Returns Manager<K, V>

delete

  • delete(key: K): boolean
  • Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist

    Parameters

    • key: K

    Returns boolean

entries

  • entries(): IterableIterator<[K, V]>
  • Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order.

    Returns IterableIterator<[K, V]>

forEach

  • forEach(callback: (value?: V, key?: K, map?: Map<K, V>) => void, context?: object): Manager<K, V>
  • Iterates through the Managers contents, calling a callback function every iteration

    Parameters

    • callback: (value?: V, key?: K, map?: Map<K, V>) => void
        • (value?: V, key?: K, map?: Map<K, V>): void
        • Parameters

          • Optional value: V
          • Optional key: K
          • Optional map: Map<K, V>

          Returns void

    • Optional context: object

    Returns Manager<K, V>

get

  • get(key: K): V
  • Get a value stored in the Manager

    Parameters

    • key: K

    Returns V

getMap

  • getMap(): Map<K, V>
  • Returns the Manager classes base Map

    Returns Map<K, V>

has

  • has(key: K): boolean
  • Checks if the Manager contains a certain key

    Parameters

    • key: K

    Returns boolean

keys

  • keys(): K[]
  • Returns the keys of all items stored in the Manager as an Array

    Returns K[]

last

  • last(distance?: number): V
  • Returns the last item in the Manager who's index is a certain distance from the last item in the Manager

    Parameters

    • distance: number = 1

    Returns V

remove

  • Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains

    Parameters

    • key: K

    Returns Manager<K, V>

set

  • Add a ManagerItem to AdvancedManager at a specified key

    Parameters

    • key: K
    • value: V

    Returns AdvancedManager<K, V>

values

  • values(): V[]
  • Returns the values of all items stored in the Manager as an Array

    Returns V[]

Generated using TypeDoc