@types/ee-first

  • Version 1.1.0
  • Published
  • 4.13 kB
  • 1 dependency
  • MIT license

Install

npm i @types/ee-first
yarn add @types/ee-first
pnpm add @types/ee-first

Overview

TypeScript definitions for ee-first

Index

Functions

Interfaces

Type Aliases

Functions

function first

first: <TEmitter extends any>(
eventSpec: Array<[TEmitter, ...string[]]>,
listener: first.Listener<TEmitter>
) => first.Thunk<TEmitter>;
  • Get the first event in a set of event emitters and event pairs, then clean up after itself. Invoke listener on the first event from the list specified in eventSpec.

    Parameter eventSpec

    Array of arrays, with each array in the format [ee, ...event].

    Parameter listener

    Will be called only once, the first time any of the given events are emitted. If error is one of the listened events, then if that fires first, the listener will be given the err argument. listener's arguments: - err: the first argument emitted from an error event, if applicable - ee: the event emitter that fired - event: the string event name that fired - args: an array of the arguments that were emitted on the event

Interfaces

interface Thunk

interface Thunk<TEmitter extends EventEmitter> {}

    method cancel

    cancel: () => void;
    • The group of listeners can be cancelled before being invoked and have all the event listeners removed from the underlying event emitters.

    call signature

    (listener: Listener<TEmitter>): void;

      Type Aliases

      type Listener

      type Listener<TEmitter extends EventEmitter> = (
      err: any,
      ee: TEmitter,
      event: string[],
      args: any[]
      ) => void;

        Package Files (1)

        Dependencies (1)

        Dev Dependencies (0)

        No dev dependencies.

        Peer Dependencies (0)

        No peer dependencies.

        Badge

        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/ee-first.

        • Markdown
          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/ee-first)
        • HTML
          <a href="https://www.jsdocs.io/package/@types/ee-first"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>