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

async-listener

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-listener - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

test/add-remove.tap.js

32

glue.js

@@ -9,3 +9,3 @@ 'use strict';

listener = list[i];
data[i] = listener.onAsync();
data[i] = listener.onAsync.call(this);
}

@@ -93,23 +93,2 @@ return data;

// Shim activator for functions that have callback last
function activator(fn) {
return function () {
var index = arguments.length - 1;
if (typeof arguments[index] === "function") {
arguments[index] = wrapCallback(arguments[index]);
}
return fn.apply(this, arguments);
};
}
// Shim activator for functions that have callback first
function activatorFirst(fn) {
return function () {
if (typeof arguments[0] === "function") {
arguments[0] = wrapCallback(arguments[0]);
}
return fn.apply(this, arguments);
};
}
function addAsyncListener(onAsync, callbackObject) {

@@ -123,6 +102,7 @@ var listener = {

return listener;
return listener.onAsync;
}
function removeAsyncListener(onAsync) {
if (!onAsync) throw new Error("must pass listener to remove");
var index = -1;

@@ -143,6 +123,2 @@ for (var i = 0; i < listeners.length; i++) {

module.exports = {
wrapCallback : wrapCallback,
activator : activator,
activatorFirst : activatorFirst
};
module.exports = wrapCallback;

@@ -5,11 +5,29 @@ 'use strict';

var shimmer = require('shimmer')
, wrap = shimmer.wrap
, massWrap = shimmer.massWrap
, glue = require('./glue.js')
, wrapCallback = glue.wrapCallback
, activator = glue.activator
, activatorFirst = glue.activatorFirst
var shimmer = require('shimmer')
, wrap = shimmer.wrap
, massWrap = shimmer.massWrap
, wrapCallback = require('./glue.js')
;
// Shim activator for functions that have callback last
function activator(fn) {
return function () {
var index = arguments.length - 1;
if (typeof arguments[index] === "function") {
arguments[index] = wrapCallback(arguments[index]);
}
return fn.apply(this, arguments);
};
}
// Shim activator for functions that have callback first
function activatorFirst(fn) {
return function () {
if (typeof arguments[0] === "function") {
arguments[0] = wrapCallback(arguments[0]);
}
return fn.apply(this, arguments);
};
}
var net = require('net');

@@ -16,0 +34,0 @@ wrap(net.Server.prototype, '_listen2', function (original) {

{
"name": "async-listener",
"version": "0.0.2",
"version": "0.0.3",
"description": "Polyfill exporting trevnorris's 0.11+ process.addAsynListener API.",

@@ -5,0 +5,0 @@ "author": "Forrest L Norvell <ogd@aoaioxxysz.net>",

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