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

async-emitter

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-emitter - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

29

emitter.js

@@ -44,4 +44,9 @@ /**

if( typeof handler !== 'function' )
if( handler === void 0 || handler === null ) {
throw new Error( 'Missing argument "handler"' )
}
if( typeof handler !== 'function' && typeof handler.handleEvent !== 'function' ) {
throw new TypeError( 'Handler must be a function.' )
}

@@ -81,3 +86,5 @@ this._events[ type ] ?

this.removeListener( type, wrapper )
handler.apply( this, arguments )
typeof handler !== 'function'
? handler.handleEvent.apply( handler, arguments )
: handler.apply( this, arguments )
}

@@ -120,5 +127,7 @@

Emitter.nextTick(
function( handler ) {
handler.apply( this, argv )
}.bind( this, listeners[i] )
function( handler, argv ) {
typeof handler !== 'function'
? handler.handleEvent.apply( handler, argv )
: handler.apply( this, argv )
}.bind( this, listeners[i], argv )
)

@@ -154,6 +163,9 @@ }

var argv = [].slice.call( arguments, 1 )
var i, len = listeners.length
var handler, i, len = listeners.length
for( i = 0; i < len; i++ ) {
listeners[i].apply( this, argv )
handler = listeners[i]
typeof handler !== 'function'
? handler.handleEvent.apply( handler, arguments )
: handler.apply( this, arguments )
}

@@ -202,5 +214,2 @@

if( typeof handler !== 'function' )
throw new TypeError( 'Handler must be a function.' )
var handlers = this._events[ type ]

@@ -207,0 +216,0 @@ var position = handlers.indexOf( handler )

{
"name": "async-emitter",
"version": "1.0.0",
"version": "1.1.0",
"description": "Non-blocking event emitter",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -37,5 +37,5 @@

- {Emitter} __emitter.on__( *string* __event__, *function* __handler__ )
- {Emitter} __emitter.on__( *string* __event__, *function|object* __handler__ )
- {Emitter} __emitter.once__( *string* __event__, *function* __handler__ )
- {Emitter} __emitter.once__( *string* __event__, *function|object* __handler__ )

@@ -46,3 +46,3 @@ - {Boolean} __emitter.emit__( *string* __event__, [arg1], [arg2], [...] )

- {Emitter} __emitter.removeListener__( *string* __event__, *function* __handler__ )
- {Emitter} __emitter.removeListener__( *string* __event__, *function|object* __handler__ )

@@ -49,0 +49,0 @@ - {Emitter} __emitter.removeAllListeners__( *string* [event] )

Sorry, the diff of this file is not supported yet

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