🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@async-generator/emitter-on

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@async-generator/emitter-on

ponyfill for EventEmitter.on in node 13+

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

returns an that iterates eventName events emitted by the emitter

This is a ponyfill for NodeJS's EventEmitter.on

installation

> npm i @async-generator/emitter-on

usage

const on = require("@async-generator/emitter-on");

const emitter = new EventEmitter();

for await (const item of on(emitter, "data")) {
  console.log(item); // will log { id: 1 }, { id: 2 } etc.
}

// somewhere else in your code
emitter.emit("data", { id: 1 });
emitter.emit("data", { id: 2 });
emitter.emit("data", { id: 3 });
emitter.emit("data", { id: 4 });

Keywords

async

FAQs

Package last updated on 15 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts