nanoevents
Simple and tiny (107 bytes) event emitter library

nanoevents downloads nanoevents version nanoevents license

nanoeventsSimilar Packages:
Npm Package Weekly Downloads Trend
3 Years
🌟 Show real-time usage chart on nanoevents's README.md, just copy the code below.
## Usage Trend
[![Usage Trend of nanoevents](https://npm-compare.com/img/npm-trend/THREE_YEARS/nanoevents.png)](https://npm-compare.com/nanoevents#timeRange=THREE_YEARS)
Cumulative GitHub Star Trend
🌟 Show GitHub stars trend chart on nanoevents's README.md, just copy the code below.
## GitHub Stars Trend
[![GitHub Stars Trend of nanoevents](https://npm-compare.com/img/github-trend/nanoevents.png)](https://npm-compare.com/nanoevents)
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
nanoevents356,0651,5945.43 kB0a year agoMIT
README for nanoevents

Nano Events

Simple and tiny event emitter library for JavaScript.

  • Only 108 bytes (minified and brotlied). It uses Size Limit to control size.
  • The on method returns unbind function. You don’t need to save callback to variable for removeListener.
  • TypeScript and ES modules support.
  • No aliases, just emit and on methods. No Node.js EventEmitter compatibility.
import { createNanoEvents } from 'nanoevents'

const emitter = createNanoEvents()

const unbind = emitter.on('tick', volume => {
  summary += volume
})

emitter.emit('tick', 2)
summary //=> 2

unbind()
emitter.emit('tick', 2)
summary //=> 2

  Made at Evil Martians, product consulting for developer tools.


Docs

Read full docs here.