Bad Behavior
Super-tiny observable. That's literally all it is.
Why should I use this?
Sometimes RxJs feels like overkill. It is a wonderful library, but sometimes you need a little bit of reactivity, not a whole system of reactivity. This library is an approximation of the BehaviorSubject
, one of the most useful Observables out there. In truth, bad-behavior is nothing more than a fancy multi-cast event emitter.
How do I use it?
// if using NPM, import it, otherwise it should already be on window // create a bad behaviorlet obs = // subscribe to listen for new valueslet sub1 = obslet sub2 = obs // call next to publish a new valueobsnext10 // unsubscribe to stop listeningsub
Why did you build this?
I kept reusing this piece of code to build animation libraries, especially when building micro-libraries. I figured, why not share this little piece of code with everyone? Plus I got sick of copying and pasting it...
Installation
npm i -S bad-behavior
OR
License
bad-behavior
is licensed under the MIT license.