
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
event-emitters
Advanced tools
Typesafe event emitters.
Similar to node's EventEmitter but:
T.const emitter = new EventEmitter<number>()
const listener = (n: number): void => {
console.log(n)
}
emitter.subscribe(listener)
emitter.emit(42)
try {
emitter.subscribe(listener)
} catch (e) {
console.log('same listener')
}
emitter.unsubscribe(listener)
try {
emitter.unsubscribe(() => {})
} catch (e) {
console.log('listener not found')
}
The above will log:
42
same listener
listener not found
const emitter = new EventEmitter<number>()
async function logEmitterValues(emitter: EventEmitter<number>) {
for await (const val of emitter) {
console.log(val)
}
}
logEmitterValues(emitter)
emitter.emit(42)
emitter.emit(43)
The above will log:
42
43
const emitter = new EventEmitter<number>()
const listener = emitter.subscribe((val: number) => {
console.log(val)
})
emitter.unsubscribe(listener)
subscribe returns the callback passed to it which can be useful for unsubscribing later.
Provides the same API as EventEmitter but:
const emitter = new EventEmitterWithCurrent<number>(42)
emitter.subscribe((n: number): void => {
console.log(n)
})
emitter.emit(43)
The above will log:
42
43
Provides the same API as EventEmitterWithCurrent but:
const emitter = new EventEmitterWithCurrent<number>()
emitter.subscribe((n: number): void => {
console.log(n)
})
emitter.emit(43)
The above will log:
43
Provides the same API as EventEmitter but:
const emitter = new EventEmitterWithCurrent<number>(42)
emitter.emit(44)
emitter.emit(45)
emitter.subscribe((n: number): void => {
console.log(n)
})
emitter.emit(46)
The above will log:
44
45
46
FAQs
event emitters
The npm package event-emitters receives a total of 9 weekly downloads. As such, event-emitters popularity was classified as not popular.
We found that event-emitters demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.