1.0.1 • Published 2 years ago
observable.ts v1.0.1
observable.ts 🐜
A minimal reactivity library that is
- ⚡ blazing fast
- 🛡️ secure (zero third-party dependencies)
- 🐜 super slim (<4kb)
- 🔑 fully typed
Installation
yarn add observable.ts
or
npm install --save observable.ts
or
pnpm add --save observable.ts
Usage
// create the observerable with an initial value
const fontColor = new Observerable('blue');
// subscribe an observer to listen for changes of `color.value`
fontColor.subscribe((newColor: string) => console.log(newColor));
// changes to the value of color will be propagate onto all registered observers
fontColor.value = 'yellow';
// OUTPUT: "yellow"
For more details see the Documentation.
License
MIT