
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@yandeu/events
Advanced tools
Simplified and TypeScripted version of EventEmitter3@4.0.7
(no support for Symbols)
npm install @yandeu/events
// ES2015+
https://unpkg.com/@yandeu/events/umd/events.min.js
// ES5
https://unpkg.com/@yandeu/events/umd/events.es5.min.js
const { Events } = require('@yandeu/events')
// or
// import { Events } from '@yandeu/events'
const events = new Events()
events.on('message', msg => {
console.log(`Message: ${msg}`)
})
events.emit('message', 'Hello there!')
// will print: Message: Hello there!
// print the current version
console.log('Events VERSION: ', Events.VERSION)
import { Events } from '@yandeu/events'
interface EventMap {
signal: () => void
error: (err: string) => void
something: (a: number, b: { color?: string }, c: [number, number, string]) => void
}
const events = new Events<EventMap>()
events.on('something', (a, b, c) => {
console.log(a, b.color, c)
})
events.emit('something', 1, { color: 'blue' }, [2, 2, 'k'])
import type { EventListener } from '@yandeu/events'
// typed listener
const listener: EventListener<EventMap, 'error'> = err => {
console.log('err:', err)
}
// add listener
events.on('error', listener)
// remove listener
// (once you don't need it anymore)
events.removeListener('error', listener)
FAQs
⚡ Simplified and TypeScripted version of EventEmitter3@4.0.7
We found that @yandeu/events demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.