Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bad-behavior

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bad-behavior

Super-tiny observable. That's literally all it is.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.1K
decreased by-23.45%
Maintainers
1
Weekly downloads
 
Created
Source

Bad Behavior

Super-tiny observable. That's literally all it is.

npm version gzip size

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
import BadBehavior from 'bad-behavior'

// create a bad behavior
let obs = BadBehavior()

// subscribe to listen for new values
let sub1 = obs.subscribe(s => { console.log(s)  })
let sub2 = obs.subscribe(s => { console.error(s) })

// call next to publish a new value
obs.next(10)

// unsubscribe to stop listening
sub.unsubscribe()

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

<script src="https://unpkg.com/bad-behavior/dist/cdn/bad-behavior.min.js"></script>

License

bad-behavior is licensed under the MIT license.

FAQs

Package last updated on 28 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc