Skip to content

Morglod/plankee

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

plank event emitter

Smallest was 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
import { pee } from "plankee";

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

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

emitLog("hello world!");

removeListener();

API

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

// subscribe returns disposer