An open API service indexing awesome lists of open source software.

https://github.com/morglod/plankee

world smallest event emitter
https://github.com/morglod/plankee

eventemitter events javascript minimal smallest tiny

Last synced: about 1 month ago
JSON representation

world smallest event emitter

Awesome Lists containing this project

README

          

# plank event emitter

Smallest was [nanoevents](https://github.com/ai/nanoevents) but it is 219 minified size and 138 brotlied **(not 107!!!)**

So why we should waste so much memory in JS?

Real original size 93 bytes
Real broitled size **81 bytes**
Broitled size inside app **77 bytes**

Usage:

```
npm i plankee
```

```ts
import { pee } from "plankee";

const [onLog, emitLog] = pee<[text: string]>();

const removeListener = onLog((text) => console.log("log: " + text));

emitLog("hello world!");

removeListener();
```

## API

```ts
[subscribe, emit] = pee<[ARGUMENTS]>();

// subscribe returns disposer
```