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

listen

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

listen - npm Package Compare versions

Comparing version 0.3.1 to 0.4.0

CHANGES.md

4

lib/error-list.js

@@ -1,5 +0,5 @@

/**
/*
* listen.js
*
* Copyright (c) 2012 Maximilian Antoni <mail@maxantoni.de>
* Copyright (c) 2012-2013 Maximilian Antoni <mail@maxantoni.de>
*

@@ -6,0 +6,0 @@ * @license MIT

@@ -1,2 +0,2 @@

/**
/*
* listen.js

@@ -75,7 +75,15 @@ *

function listener(fn, timeout) {
function listener(name, fn, timeout) {
assertUnresolved();
if (typeof fn === 'number') {
if (typeof name === 'function') {
timeout = fn;
fn = name;
name = null;
} else if (typeof name === 'number') {
timeout = name;
fn = null;
name = null;
} else if (typeof fn === 'number') {
timeout = fn;
fn = null;
}

@@ -98,2 +106,5 @@ var index = offset + count++;

values[index] = value;
if (name) {
values[name] = value;
}
}

@@ -100,0 +111,0 @@ if (++called === count && handler) {

@@ -1,5 +0,5 @@

/**
/*
* listen.js
*
* Copyright (c) 2012 Maximilian Antoni <mail@maxantoni.de>
* Copyright (c) 2012-2013 Maximilian Antoni <mail@maxantoni.de>
*

@@ -6,0 +6,0 @@ * @license MIT

{
"name" : "listen",
"version" : "0.3.1",
"version" : "0.4.0",
"description" : "Wait for the results of multiple callbacks",
"keywords" : ["callback", "thenable"],
"author" : "Maximilian Antoni (http://maxantoni.de)",

@@ -19,14 +20,12 @@ "homepage" : "https://github.com/mantoni/listen.js",

"devDependencies" : {
"utest" : "~0.0.6",
"utest" : "~0.0.8",
"urun" : "~0.0.6",
"sinon" : "~1.6.0",
"uglify-js" : "~1.2.6",
"autolint" : "~1.0.4"
"autolint" : "~1.0.4",
"phantomic" : "~0.2.0",
"browserify" : ">=2.13 <3",
"consolify" : "~0.2.0"
},
"nomo" : {
"name" : "listen.js",
"require" : "lib/listen",
"exportTarget" : "window.listen",
"fileName" : "listen.js"
}
"files" : ["lib", "README.md", "CHANGES.md", "LICENSE"]
}

@@ -1,2 +0,2 @@

# listen.js
# listen.js [![Build Status](https://secure.travis-ci.org/mantoni/listen.js.png?branch=master)](http://travis-ci.org/mantoni/listen.js)

@@ -7,5 +7,4 @@ Wait for the results of multiple callbacks

[![Build Status](https://secure.travis-ci.org/mantoni/listen.js.png?branch=master)](http://travis-ci.org/mantoni/listen.js)
## Install on Node
## Install with NPM

@@ -18,5 +17,8 @@ ```

Browser package are here: http://maxantoni.de/listen.js/
Standalone browser package are here: http://maxantoni.de/listen.js/
However, you may want to use npm and bundle it with your application using
[Browserify](http://browserify.org).
## Usage

@@ -56,11 +58,32 @@

#### `listen([values])`
Creates and returns a new listener. The values array with initial values is optional.
#### `listen()`
Creates and returns a new listener function.
#### `listener([timeout])`
Creates a new callback associated with the listener. If the optional timeout is given, the listener errs with a `TimeoutError` if the callback was not invoked. Throws if called after `then`.
#### `listen(values)`
Creates and returns a new listener with the given initial values.
#### `listener(func[, timeout])`
Creates a new callback which passes the arguments to the given function. Can be combined with an optional timeout. Throws if called after `then`.
#### `listener()`
Creates a new callback associated with the listener. Throws if called after `then`.
#### `listener(name)`
Creates a new named callback that provides its value under the given name.
#### `listener(timeout)`
Creates a new callback that errs with a `TimeoutError` if the callback was not invoked within the given timeout.
#### `listener(func)`
Creates a new callback that also invokes the given function with `(err, value)`.
#### `listener(name, func)`
Combined `listener(name)` and `listener(func)`.
#### `listener(name, timeout)`
Combined `listener(name)` and `listener(timeout)`.
#### `listener(func, timeout)`
Combined `listener(func)` and `listener(timeout)`.
#### `listener(name, func, timeout)`
Combined `listener(name)`, `listener(func)` and `listener(timeout)`.
#### `listener.then(func)`

@@ -75,23 +98,14 @@ Invokes the given function once all callbacks where invoked. If none of the callbacks had errors, the first argument is `null`, otherwise it's an `Error`. The second argument is the values array in order of callback creation. Can only be called once.

## Run tests
```
make
```
## Contributing
## Contrubuting
Here is what you need for development:
If you'd like to contribute to listen.js here is how to get started:
- `npm install` will install all the dev dependencies
- `make` does all of the following
- `make lint` lint the code with JSLint
- `make test` runs all unit tests in Node
- `make browser` generates a static web page at `test/all.html` to run the tests in a browser.
- `make phantom` runs all tests in a the headless [Phantom.JS](http://phantomjs.org). Make sure you have `phantomjs` in your path.
- Fork the project on GitHub.
- `npm install` will setup everything you need.
- `make` lints the code with JSLint and runs all unit tests.
- Use can also `make lint` or `make test` individually.
Running the test cases in a browser instead of Node requires [nomo.js](https://github.com/mantoni/nomo.js).
- Run `npm install -g nomo`
- Run `nomo server` from within the project directory.
- Open http://localhost:4444/test in your browser.
To build a browser package containing the merged / minified scripts run `make package`.
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