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

emits-change

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emits-change

Plug-and-play node.js events integration to emit change events

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

emits-change

Software License Build Status

Plug-and-play node.js events integration to emit change events.

Installation

npm install emits-change

This package uses the node.js events API. Make sure your javascript bundler can handles importing core node modules (e.g. Browserify does this).

Usage

Calling emitsChange on an object will add node's EventEmitter, a listen, an unlisten and an emitChange function to the prototype.

import emitsChange from 'emits-change'

class Emitter {
    constructor() {
        emitsChange(this)
    }
}

let emitter = new Emitter

function doSomethingOnChange() {
    console.log('hodor')
}

emitter.listen(doSomethingOnChange)

emitter.emitChange()
// => hodor

emitter.unlisten(doSomethingOnChane)

emitter.emitChange()
// => *nothing*

Testing

You can run the tests (ESLint & Mocha) with:

npm run test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email freek@spatie.be instead of using the issue tracker.

Credits

About Spatie

Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.

License

The MIT License (MIT). Please see License File for more information.

Keywords

FAQs

Package last updated on 12 Nov 2015

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