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

arbitrary-emitter

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arbitrary-emitter - npm Package Compare versions

Comparing version 0.10.0 to 0.10.1

9

arbitrary-emitter.js

@@ -8,3 +8,3 @@ 'use strict'

function setActions (e, listeners) {
const size = listeners.length
let size = listeners.length
if (!size) {

@@ -17,4 +17,5 @@ events.delete(e.key)

actions.set(e.key, opts => {
for (let i = 0; i < size; i++) {
listeners[i](opts)
let size = listeners.length
while (size > 0) {
listeners[--size](opts)
}

@@ -32,3 +33,3 @@ })

if (listeners.indexOf(fn) === -1) {
listeners.push(fn)
listeners.unshift(fn)
}

@@ -35,0 +36,0 @@ setActions(e, listeners)

{
"name": "arbitrary-emitter",
"version": "0.10.0",
"version": "0.10.1",
"description": "Event emitter with ES6 Map sugar for modern browsers and node.js",

@@ -5,0 +5,0 @@ "main": "arbitrary-emitter.js",

@@ -6,3 +6,3 @@ arbitrary-emitter

[![Build Status](https://travis-ci.org/jacoborus/arbitrary-emitter.svg?branch=master)](https://travis-ci.org/jacoborus/arbitrary-emitter) [![npm version](https://badge.fury.io/js/arbitrary-emitter.svg)](https://www.npmjs.com/package/arbitrary-emitter)
[![Build Status](https://travis-ci.org/jacoborus/arbitrary-emitter.svg?branch=master)](https://travis-ci.org/jacoborus/arbitrary-emitter) [![npm version](https://badge.fury.io/js/arbitrary-emitter.svg)](https://www.npmjs.com/package/arbitrary-emitter) ![npm dependencies](https://david-dm.org/jacoborus/arbitrary-emitter.svg)

@@ -9,0 +9,0 @@ **arbitrary-emitter** stores listeners and actions in Maps, this allows to use arbitrary values as keys for your listeners.

@@ -105,1 +105,23 @@ 'use strict'

})
test('remove listener while emitting', t => {
const emitter = ae()
const out = []
emitter.on('test', () => {
out.push(1)
})
emitter.once('test', () => {
out.push('a')
})
emitter.on('test', () => {
out.push('finish')
})
emitter.emit('test')
emitter.emit('test')
t.is(out[0], 1)
t.is(out[1], 'a')
t.is(out[2], 'finish')
t.is(out[3], 1)
t.is(out[4], 'finish')
t.end()
})
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