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

eenano

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

eenano - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

11

eenano.js

@@ -8,3 +8,4 @@ module.exports = EENano

}
EENano.prototype.emit = Function()
EENano.prototype.emit = function noop() {}
function emit(event, metadata) {

@@ -14,7 +15,9 @@ var handlers = this._listeners[event]

for (var i = 0; i < handlers.length; i++) {
handlers[i].call(this, metadata)
var fn = handlers[i].handler
var thisArg = handlers[i].thisArg || this
fn.call(thisArg, metadata)
}
}
}
EENano.prototype.on = function (event, handler) {
EENano.prototype.on = function (event, handler, thisArg) {
if (!this.hasListeners) {

@@ -24,3 +27,3 @@ this.emit = emit

}
this._listeners[event] = this.listeners(event).concat(handler)
this._listeners[event] = this.listeners(event).concat({handler: handler, thisArg: thisArg})
}

@@ -27,0 +30,0 @@ EENano.prototype.events = function () {

{
"name": "eenano",
"version": "1.0.0",
"version": "2.0.0",
"description": "A tiny pessimistic event emitter. Optimized for no listeners.",

@@ -5,0 +5,0 @@ "main": "eenano.js",

@@ -8,3 +8,3 @@ eenano

This EventEmitter is optimized for no listeners on an event. It should be plenty fast if there are listeners, of course...
This EventEmitter is optimized for no listeners on any event. It should be plenty fast if there are listeners, of course...

@@ -18,4 +18,9 @@ It doesn't do most of what the core EventEmitter library does. If you need features, just use core.

* domains
* polymorphic event handlers
* and more! (less?)
A list of what it does the core library doesn't:
* Optimized for no listeners at all
* Allows you to specify a `this` with `.on` to avoid `Function#bind`
```javascript

@@ -42,6 +47,6 @@

`.on(event, handler)`
`.on(event, handler[, thisArg])`
---
On `event` synchronously call `handler()`
On `event` synchronously call `handler()` if provided, call `handler` with `this` set to `thisArg`

@@ -48,0 +53,0 @@ `.emit(event, message)`

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