New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

zen-mitt

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zen-mitt

light-weight(187B min+gzip) typesafe event mitter

latest
npmnpm
Version
3.1.0
Version published
Weekly downloads
584
-22.75%
Maintainers
1
Weekly downloads
 
Created
Source

zen-mitt

light-weight(187B min+gzip) typesafe event emitter

Install

npm install zen-mitt
yarn add zen-mitt
pnpm add zen-mitt

Usage

import { mitt } from 'zen-mitt'

const events = mitt<{
  foo: [data: number]
  arr: [data: string[]]
  param: [name: string, age?: number]
}>()
events.on('foo', console.log)
events.emit('foo', 1)

events.on('arr', console.log)
events.emit('arr', ['test'])
events.off('arr')

events.once('param', console.log)
events.emit('param', 'test', 1)

events.off() // clear all listeners

Class version

import { Mitt } from 'zen-mitt/class'

const events = new Mitt()

License

MIT

Keywords

event emitter

FAQs

Package last updated on 19 Feb 2025

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