Options
All
  • Public
  • Public/Protected
  • All
Menu

An Event Emitter

Hierarchy

  • Manager<string, Event>
    • EventEmitter

Index

Constructors

constructor

  • Returns EventEmitter

Properties

map

map: Map<string, Event>

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<[string, Event]>

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

    Returns Manager<string, Event>

clear

  • Clears events and event listeners

    Returns EventEmitter

delete

  • delete(key: string): 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: string

    Returns boolean

emit

  • Call all listeners within an event

    Parameters

    • events: string | any[]
    • Rest ...args: any

    Returns EventEmitter

entries

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

    Returns IterableIterator<[string, Event]>

forEach

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

    Parameters

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

          • Optional value: Event
          • Optional key: string
          • Optional map: Map<string, Event>

          Returns void

    • Optional context: object

    Returns Manager<string, Event>

get

  • Get a value stored in the Manager

    Parameters

    • key: string

    Returns Event

getEvent

  • getEvent(name: string): Event
  • Gets event, if event doesn't exist create a new one

    Parameters

    • name: string

    Returns Event

getMap

  • getMap(): Map<string, Event>
  • Returns the Manager classes base Map

    Returns Map<string, Event>

has

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

    Parameters

    • key: string

    Returns boolean

keys

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

    Returns string[]

last

  • last(distance?: number): Event
  • 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 Event

newListener

  • Creates a listener and adds it to an event

    Parameters

    Returns Event

off

  • Remove a listener from a given event, or just completely remove an event

    Parameters

    Returns EventEmitter

on

once

remove

  • remove(key: string): Manager<string, Event>
  • Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains

    Parameters

    • key: string

    Returns Manager<string, Event>

removeListener

  • Removes a listener from an event

    Parameters

    Returns Event

set

  • set(key: string, value: Event): Manager<string, Event>
  • Set a value to the Manager using a key

    Parameters

    Returns Manager<string, Event>

values

  • Returns the values of all items stored in the Manager as an Array

    Returns Event[]

Generated using TypeDoc