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

async-glob-events

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-glob-events - npm Package Compare versions

Comparing version 0.2.0 to 1.0.0

7

CHANGES.md
# Changes
## 1.0.0
- Use `glob-events` 1.0
- Allow to configure the scope to use on listener registration
## 0.2.0
- Bump glob-events to 0.5.0
- Bump `glob-events` to 0.5

@@ -7,0 +12,0 @@ ## 0.1.1

67

lib/events.js

@@ -59,3 +59,3 @@ /*

function createListener(fn) {
function createListener(fn, scope) {
if (typeof fn !== 'function') {

@@ -65,23 +65,20 @@ throw new TypeError(E_LISTENER);

return function () {
var res;
var res, args, cb;
if (fn.length > arguments.length) {
var args = this.args.slice();
var cb = this.callback();
cb = this.callback();
args = this.args.slice();
args[fn.length - 1] = cb;
try {
res = fn.apply(this, args);
if (res !== undefined) {
cb(null, res);
}
} catch (err) {
cb(err);
}
} else {
try {
res = fn.apply(this, arguments);
if (res !== undefined) {
this.callback.push(res);
}
} catch (err) {
this.callback.err(err);
args = arguments;
}
try {
res = fn.apply(scope || this, args);
} catch (err) {
(cb || this.callback.err)(err);
}
if (res !== undefined) {
if (cb) {
cb(null, res);
} else {
this.callback.push(res);
}

@@ -93,16 +90,28 @@ }

AyncEmitter.prototype.addListener = function (event, fn) {
var l = createListener(fn);
l._once = fn;
addListener.call(this, event, l);
var o = { orig : fn };
var s;
if (typeof event === 'string') {
o.event = event;
} else {
o.event = event.event;
s = event.scope;
}
addListener.call(this, o, createListener(fn, s));
};
AyncEmitter.prototype.once = function (event, fn) {
var l = createListener(fn);
var s = this._store;
var f = function () {
s.remove(event, f);
var t = this;
var o = { orig : fn };
var s;
if (typeof event === 'string') {
o.event = event;
} else {
o.event = event.event;
s = event.scope;
}
var l = createListener(fn, s);
addListener.call(this, o, function () {
t.removeListener(o.event, fn);
l.apply(this, arguments);
};
f._once = fn;
addListener.call(this, event, f);
});
};

@@ -109,0 +118,0 @@

{
"name" : "async-glob-events",
"version" : "0.2.0",
"version" : "1.0.0",
"description" : "Event emitter with glob support on event names and asynchronous listeners",

@@ -14,4 +14,4 @@ "keywords" : ["event", "emitter", "glob", "listener", "async", "return values"],

"start" : "mocha --watch",
"lint" : "jslint --color './**/*.js'",
"test-wd" : "mochify --wd",
"lint" : "jslint --color \"**/*.js\"",
"wd" : "mochify --wd",
"test" : "npm run lint && mocha && mochify --cover"

@@ -24,10 +24,10 @@ },

"dependencies" : {
"inherits" : "^2.0.1",
"listen" : "^1.0.0",
"glob-events" : "~0.5.0"
"inherits" : "^2.0",
"listen" : "^1.0",
"glob-events" : "^1.0"
},
"devDependencies" : {
"mocha" : "^1.17.0",
"jslint" : "~0.3.3",
"mochify" : "~0.9.0"
"mocha" : "^1.21",
"jslint" : "^0.6",
"mochify" : "^1.1"
},

@@ -34,0 +34,0 @@ "files" : ["lib", "README.md", "CHANGES.md", "LICENSE"],

@@ -1,13 +0,13 @@

# async-glob-events.js [![Build Status](https://travis-ci.org/mantoni/async-glob-events.js.png?branch=master)](http://travis-ci.org/mantoni/async-glob-events.js)
# async-glob-events.js
[![Build Status]](https://travis-ci.org/mantoni/async-glob-events.js)
[![SemVer]](http://semver.org)
[![License]](https://github.com/mantoni/async-glob-events.js/blob/master/LICENSE)
Event emitter with glob support on event names and asynchronous listeners, for
node and the browser
Repository: <https://github.com/mantoni/async-glob-events.js>
---
## Features
- Inherits the features from [glob-events][]
- Inherits all features from [glob-events][]
- Pass a callback as the last argument to `emit` and receive asynchronous

@@ -17,2 +17,12 @@ errors and return values from listeners

## Install with npm
```
npm install async-glob-events
```
## Browser support
Use [Browserify](http://browserify.org) to create a standalone file.
## Usage

@@ -57,12 +67,2 @@

## Install with npm
```
npm install async-glob-events
```
## Browser support
Use [Browserify](http://browserify.org) to create a standalone file.
## License

@@ -72,2 +72,5 @@

[Build Status]: http://img.shields.io/travis/mantoni/async-glob-events.js.svg
[SemVer]: http://img.shields.io/:semver-%E2%9C%93-brightgreen.svg
[License]: http://img.shields.io/npm/l/async-glob-events.svg
[glob-events]: https://github.com/mantoni/glob-events.js
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