Giter Site home page Giter Site logo

event-registry's Introduction

event-registry

npm Dependencies Build Status Coverage Status JavaScript Standard Style

Keeps track of EventEmitter listeners and automatically removes them upon selected events. Useful when you want to avoid EventEmitter memory leaks caused by listeners not being removed.

Usage

const EventRegistry = require('event-registry')

const eventRegistry = new EventRegistry()
const emitter = getSomeEventEmitter()
const otherEmitter = getSomeOtherEventEmitter()

// Attach a listener using EventEmitter.prototype.on and remember it.
eventRegistry.on(emitter, 'data', someDataListener)

// Attach a one-off listener using EventEmitter.prototype.on and remember it.
eventRegistry.once(emitter, 'end', someEndListener)

// A single registry can track any number of event emitters.
eventRegistry.on(otherEmitter, 'progress', someProgressListener)

// When the 'end' event is emitted, remove all remembered listeners.
// Note that this will also remove the progress listener from otherEmitter.
eventRegistry.fin(emitter, 'end')

API

EventEmitter Proxies

An EventRegistry proxies the following functions to the emitter:

  • addListener(emitter, event, listener) AKA on(emitter, event, listener)
  • once(emitter, event, listener)
  • removeListener(emitter, event, listener)
  • removeAllListeners(emitter, [event])

Additionally, it keeps track of every listener passed. When a final event occurs (see below), it will remove all of these listeners.

Final Events

fin(emitter, event)

Marks the given event on the emitter as final. When that event occurs, all listeners will be removed.

unfin(emitter, event)

Undoes a call to fin. Marks the event on the emitter as non-final.

onceFin(emitter, event, listener)

Shorthand for once(emitter, event, listener) followed by fin(emitter, event). Saves you a statement in this common scenario.

clear()

Removes all attached listeners and marks all final events as non-final. Basically what happens when a final event is emitted.

Author

Tim De Pauw

License

MIT

event-registry's People

Contributors

greenkeeper[bot] avatar greenkeeperio-bot avatar timdp avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

thatcheck

event-registry's Issues

An in-range update of weak is breaking the build 🚨

Version 1.0.1 of weak just got published.

Branch Build failing 🚨
Dependency weak
Current Version 1.0.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As weak is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details
  • ❌ coverage/coveralls Coverage pending from Coveralls.io Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 12 commits.

  • 1c3b037 Release 1.0.1
  • b3a6cd1 Merge pull request #67 from laverdet/master
  • fda35ae Fix missing HandleScope in callback
  • a30b570 README: use SVG for appveyor badge
  • 59fe42c test node v5
  • 6854042 appveyor: remove v1
  • 3fb52ec fix tests
  • 999a2d1 Merge pull request #60 from robcolburn/support-4x
  • 17b9cce Add Travis support for 4.x
  • b6dd15c appveyor: place .bin into the $PATH
  • f67d397 appveyor: attempt to fix node v0.8 again
  • 77181b5 travis: attempt to fix iojs v3

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of isparta is breaking the build 🚨

Version 4.1.0 of isparta was just published.

Branch Build failing 🚨
Dependency isparta
Current Version 4.0.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

isparta is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build is in progress Details
  • ❌ continuous-integration/appveyor/branch AppVeyor build failed Details

Commits

The new version differs by 8 commits.

  • 1142f35 chore(release): version 4.1.0
  • fdcbf45 test: update expected cover to unexpected locations
  • 3763c5f test: update compiled test files
  • 7d6a4a3 chore(test): rename index spec
  • 840a066 chore(pkg): remove hide-stack-frames-from
  • 912fbee fix(pkg): force use of [email protected]
  • 638ac1e feat(pkg): update to latest esprima for enabling instrumentation of async/await (#132)
  • 7e89d4e docs(README): add unmaintained badge

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of babel-runtime is breaking the build 🚨

Version 6.25.0 of babel-runtime just got published.

Branch Build failing 🚨
Dependency babel-runtime
Current Version 6.23.0
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

babel-runtime is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/appveyor/branch AppVeyor build failed Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details
  • βœ… coverage/coveralls First build on greenkeeper/babel-runtime-6.25.0 at 97.674% Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of gulp-istanbul is breaking the build 🚨

Version 1.1.2 of gulp-istanbul just got published.

Branch Build failing 🚨
Dependency gulp-istanbul
Current Version 1.1.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As gulp-istanbul is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/appveyor/branch AppVeyor build failed Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details
  • βœ… coverage/coveralls First build on greenkeeper/gulp-istanbul-1.1.2 at 97.674% Details

Release Notes v1.1.2
  • Bump dependencies
Commits

The new version differs by 6 commits.

  • 502855e 1.1.2
  • ac8f966 Add documentation for reportOpts and watermarks (#121)
  • be326d1 Update README.md to warn about gulp-mocha (#120)
  • b0149ac fix(package): update istanbul-threshold-checker to version 0.2.1 (#112)
  • 7ec737a chore(package): update dependencies (#110)
  • b047c82 Update .travis.yml

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of sinon-chai is breaking the build 🚨

Version 2.10.0 of sinon-chai just got published.

Branch Build failing 🚨
Dependency sinon-chai
Current Version 2.9.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As sinon-chai is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details - ❌ **continuous-integration/appveyor/branch** AppVeyor build failed [Details](https://ci.appveyor.com/project/timdp/event-registry/build/125),- βœ… **coverage/coveralls** First build on greenkeeper/sinon-chai-2.10.0 at 97.674% [Details](https://coveralls.io/builds/11312599),- ❌ **continuous-integration/travis-ci/push** The Travis CI build failed [Details](https://travis-ci.org/timdp/event-registry/builds/227497928?utm_source=github_status&utm_medium=notification)

Release Notes 2.10.0

Added the calledImmediatelyBefore() and calledImmediatelyAfter() asserters.

Commits

The new version differs by 3 commits0.

  • 9aa5a73 Version 2.10.0
  • 4d32c50 Add a test showing that #94 is not a problem
  • f0628a1 Add calledImmediatelyBefore/calledImmediatelyAfter

false

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of gulp-sourcemaps is breaking the build 🚨

Version 2.6.1 of gulp-sourcemaps just got published.

Branch Build failing 🚨
Dependency gulp-sourcemaps
Current Version 2.6.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As gulp-sourcemaps is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/appveyor/branch AppVeyor build failed Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details
  • βœ… coverage/coveralls First build on greenkeeper/gulp-sourcemaps-2.6.1 at 97.674% Details

Commits

The new version differs by 4 commits.

  • 4b723f0 bump 2.6.1
  • 92c489c Merge pull request #323 from gulp-sourcemaps/nmccready/loggingMemleak
  • da4cdb2 fix npm
  • a21f037 fix: issue 317 memory leak on logging

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of babel-register is breaking the build 🚨

Version 6.26.0 of babel-register just got published.

Branch Build failing 🚨
Dependency babel-register
Current Version 6.24.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-register is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/appveyor/branch AppVeyor build failed Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details
  • βœ… coverage/coveralls First build on greenkeeper/babel-register-6.26.0 at 97.674% Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.