Class Delegate<T>

Description

Delegates actions to a weak set of listeners

example

import { Action, Delegate } from 'peekeasy'

const set = new Set<Action<[string, string]>>(),
delegate = new Delegate(set)

delegate.then(async message => console.log(...message))

// Hello, delegate!
set.forEach(f => f('Hello,', 'delegate!'))

Type Parameters

  • T extends any[] = []

Hierarchy

  • Delegate

Implements

  • WeakSet<Action<T>>
  • AsyncIterable<T>
  • PromiseLike<T>

Constructors

Properties

Accessors

Methods

Constructors

  • Type Parameters

    • T extends any[] = []

    Parameters

    • Rest ...sets: Set<Action<T>>[]

      event senders

    Returns Delegate<T>

Properties

sets: Set<Action<T>>[]

Accessors

  • get [toStringTag](): string
  • Returns string

Methods

  • Returns AsyncGenerator<T, void, unknown>

  • Parameters

    • listener: Action<T>

    Returns boolean

  • Parameters

    • listener: Action<T>

    Returns boolean

  • Type Parameters

    • U = T

    • V = never

    Parameters

    • Optional onfulfilled: ((args: T) => PromiseLike<U>)
        • (args: T): PromiseLike<U>
        • Parameters

          • args: T

          Returns PromiseLike<U>

    • Optional onrejected: ((reason: unknown) => PromiseLike<V>)
        • (reason: unknown): PromiseLike<V>
        • Parameters

          • reason: unknown

          Returns PromiseLike<V>

    Returns Promise<any>

Generated using TypeDoc