
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.
[](https://www.npmjs.com/package/mittt) [](https://www.npmjs.com/package/mittt) [
The ESM build is also available on unpkg:
<script type="module" src="https://unpkg.com/mittt/dist/mittt.esm.js"></script>
import mittt from 'mittt'
const emitter = mittt()
function onEvent(eventType, payload) {
console.log(eventType, payload)
}
// Listen to an event
emitter.on('foo', onEvent)
// Listen to all events
emitter.on('*', onEvent)
// Fire an event
emitter.emit('foo')
// Fire an event with payload
const payload = { a: 'b' }
emitter.emit('bar', payload)
// Fire all registered handlers with payload
emitter.emit('*', payload) // payload is optional
// Given these listeners. Both onEvent would be invoked on '*' emit.
emitter.on('foo', onEvent)
emitter.on('bar', onEvent)
emitter.emit('*', payload)
// Fire all unique registered handlers with payload
emitter.emit('*!', payload) // payload is optional
// Given these listeners. Only one onEvent would be invoked on '*!' emit.
emitter.on('foo', onEvent)
emitter.on('bar', onEvent)
emitter.emit('*!', payload)
// Given these listeners. Both handlers would be invoked on '*!' emit.
emitter.on('foo', (eventType, payload) => {})
emitter.on('bar', (eventType, payload) => {})
emitter.emit('*!', payload)
// Working with handler references:
emitter.on('foo', onEvent) // listen
emitter.off('foo', onEvent) // unlisten
// Initiate emitter with on event setup
const eventHandlerMap = Object.create(null)
eventHandlerMap.foo = [
(eventType, payload) => {
console.log(eventType, payload) // foo, 123
},
(eventType, payload) => {
console.log(eventType, payload) // foo, 123
},
]
const emitter = mittt(eventHandlerMap)
emitter.emit('foo', 123) // all handlers for foo are invoked
import mittt, { Emitter, EventHandler } from 'mittt'
const emitter: Emitter = mittt()
let foo: EventHandler = (eventType, payload) => {}
emitter.on('foo', foo)
If you want to install the smallest size without wildcard (*) support.
~200 bytes gzipped size.
npm install mittt@^1
# or
# yarn add mittt@^1
FAQs
[](https://www.npmjs.com/package/mittt) [](https://www.npmjs.com/package/mittt) [
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.