Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HookAsyncIterator<T, EventTypes>

Type parameters

  • T

  • EventTypes: string | symbol

Hierarchy

  • AsyncIterableSubject<T>
    • HookAsyncIterator

Implements

  • AsyncIterableIterator<T>
  • AsyncIterableIterator<T>

Index

Constructors

constructor

Properties

bufferSize

bufferSize: number

canPull

canPull: boolean

Protected ended

ended: boolean

isPulling

isPulling: boolean

Protected pullQueue

pullQueue: Future<IteratorResult<T>>[]

Protected pullThrottle

pullThrottle: Semaphore

Protected pushBuffer

pushBuffer: Either<T, any>[]

queueSize

queueSize: number

Protected release

Protected releaseEnd

Protected releaseError

Protected returnFuture

returnFuture: Future<void>

Protected returned

returned: boolean

Static prefixed

prefixed: string | boolean

Methods

[Symbol.asyncIterator]

  • [Symbol.asyncIterator](): AsyncIterableIterator<T>

addListener

  • addListener(event: EventTypes, fn: ListenerFn, context?: any): this
  • Parameters

    • event: EventTypes
    • fn: ListenerFn
    • Optional context: any

    Returns this

emit

  • emit(event: EventTypes, ...args: Array<any>): boolean
  • Calls each of the listeners registered for a given event.

    Parameters

    • event: EventTypes
    • Rest ...args: Array<any>

    Returns boolean

end

  • end(): void
  • Returns void

eventNames

  • eventNames(): Array<EventTypes>
  • Return an array listing the events for which the emitter has registered listeners.

    Returns Array<EventTypes>

Protected flush

  • flush(): void
  • Returns void

listenerCount

  • listenerCount(event: EventTypes): number
  • Return the number of listeners listening to a given event.

    Parameters

    • event: EventTypes

    Returns number

listeners

  • listeners(event: EventTypes): Array<ListenerFn>
  • Return the listeners registered for a given event.

    Parameters

    • event: EventTypes

    Returns Array<ListenerFn>

next

  • next(value?: any): Promise<IteratorResult<T>>
  • Parameters

    • Optional value: any

    Returns Promise<IteratorResult<T>>

off

  • off(event: EventTypes, fn?: ListenerFn, context?: any, once?: boolean): this
  • Parameters

    • event: EventTypes
    • Optional fn: ListenerFn
    • Optional context: any
    • Optional once: boolean

    Returns this

on

  • on(event: EventTypes, fn: ListenerFn, context?: any): this
  • Add a listener for a given event.

    Parameters

    • event: EventTypes
    • fn: ListenerFn
    • Optional context: any

    Returns this

once

  • once(event: EventTypes, fn: ListenerFn, context?: any): this
  • Add a one-time listener for a given event.

    Parameters

    • event: EventTypes
    • fn: ListenerFn
    • Optional context: any

    Returns this

push

  • push(item: Either<T, any>): void
  • Parameters

    • item: Either<T, any>

    Returns void

pushException

  • pushException(exception: any): void
  • Parameters

    • exception: any

    Returns void

pushValue

  • pushValue(value: T): void
  • Parameters

    • value: T

    Returns void

Protected releaseAllHooks

  • releaseAllHooks(): void

removeAllListeners

  • removeAllListeners(event?: EventTypes): this
  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: EventTypes

    Returns this

removeListener

  • removeListener(event: EventTypes, fn?: ListenerFn, context?: any, once?: boolean): this
  • Remove the listeners of a given event.

    Parameters

    • event: EventTypes
    • Optional fn: ListenerFn
    • Optional context: any
    • Optional once: boolean

    Returns this

return

  • return(value?: any): Promise<IteratorResult<T>>
  • Parameters

    • Optional value: any

    Returns Promise<IteratorResult<T>>

Generated using TypeDoc