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

events-bluebird

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

events-bluebird - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

4

CHANGELOG.md

@@ -0,3 +1,7 @@

## v1.0.1
* [FIXED] - use `promise.then` rather than `promise.return` method
## v1.0.0 - initial release
* [ADDED] - `EventEmitter.prototype.emitAsync` & `emitAsyncSeries` & `emitAsyncParallel` methods

6

index.js

@@ -109,4 +109,6 @@ "use strict";

if (promiseCandidate instanceof Promise) {
return promiseCandidate.return(true);
if (promiseCandidate && typeof promiseCandidate.then === 'function') {
return promiseCandidate.then(function() {
return true;
});
} else {

@@ -113,0 +115,0 @@ return Promise.resolve(true);

{
"name": "events-bluebird",
"version": "1.0.0",
"version": "1.0.1",
"author": {

@@ -5,0 +5,0 @@ "email": "fogine@opmbx.org"

@@ -7,3 +7,3 @@ # events-bluebird

Adds `EventEmitter.prototype.emitAsyncSeries` & `EventEmitter.prototype.emitAsyncParallel` methods. The API reflects native `EventEmitter` API with the following necessary changes:
* Added methods returns a Promise object which when fulfilled, returns `true` if the event had listeners, `false` otherwise
* Added methods return a Promise object which when fulfilled, returns `true` if the event had listeners, `false` otherwise
* node's deprecated [domain](https://nodejs.org/api/domain.html) feature is not supported

@@ -15,3 +15,34 @@

Example
---------------------
```javascript
var EventEmitter = require('events-bluebird').EventEmitter;
var emitter = new EventEmitter;
emitter.on('event', function(param) {
return new Promise(function(resolve, reject) {
setTimeout(function() {
console.log('first');
return resolve();
}, 500);
});
});
emitter.on('event', function(param) {
console.log('later');
});
emitter.emitAsyncSeries('event', 'param').then(function(hadListeners) {
console.log(hadListeners);//true
});
// Output:
// first
// later
// true
```
Tests

@@ -18,0 +49,0 @@ -------------------

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