Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CancelEmitter

Allows cancelling multiple asynchronous calls from one instance.

Hierarchy

  • EventEmitter
    • CancelEmitter

Index

Constructors

constructor

Properties

Static EventEmitter

EventEmitter: EventEmitter

Static defaultMaxListeners

defaultMaxListeners: number

Methods

abortAndRejectOnCancel

  • abortAndRejectOnCancel<T>(abortable: IAbortable, deferred: when.Deferred<T>): when.Promise<T>
  • Call this to register a deferred with this CancelEmitter.

    api

    public

    Type parameters

    • T

    Parameters

    • abortable: IAbortable
    • deferred: when.Deferred<T>

    Returns when.Promise<T>

    A when.Promise<T> which will reject if cancel is called.

addListener

  • addListener(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

cancel

  • cancel(): void
  • Call this to cancel all abortables tracked by abortAndRejectOnCancel.

    Returns void

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

on

  • on(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

once

  • once(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc