Socket
Socket
Sign inDemoInstall

wolfy87-eventemitter

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wolfy87-eventemitter - npm Package Compare versions

Comparing version 4.2.7 to 4.2.8

2

bower.json
{
"name": "eventEmitter",
"description": "Event based JavaScript for the browser",
"version": "4.2.7",
"version": "4.2.8",
"main": [

@@ -6,0 +6,0 @@ "./EventEmitter.js"

@@ -5,3 +5,3 @@ {

"description": "Event based JavaScript for the browser.",
"version": "4.2.7",
"version": "4.2.8",
"scripts": ["EventEmitter.js"],

@@ -8,0 +8,0 @@ "main": "EventEmitter.js",

@@ -12,3 +12,2 @@ # API

* **class** - [object Object]
## getListeners

@@ -18,5 +17,4 @@

* **param** (String | RegExp) _evt_ - Name of the event to return the listeners from.
* **return** (Function[] | Object) - All listener functions for the event.
* **param** (StringRegExp) _evt_ - Name of the event to return the listeners from.
* **return** (Function[]Object) - All listener functions for the event.
## flattenListeners

@@ -28,3 +26,2 @@

* **return** (Function[]) - Just the listener functions.
## getListenersAsObject

@@ -34,5 +31,4 @@

* **param** (String | RegExp) _evt_ - Name of the event to return the listeners from.
* **param** (StringRegExp) _evt_ - Name of the event to return the listeners from.
* **return** (Object) - All listener functions for an event in an object.
## addListener

@@ -42,6 +38,5 @@

* **param** (String | RegExp) _evt_ - Name of the event to attach the listener to.
* **param** (StringRegExp) _evt_ - Name of the event to attach the listener to.
* **param** (Function) _listener_ - Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
* **return** (Object) - Current instance of EventEmitter for chaining.
## on

@@ -51,11 +46,9 @@

## addOnceListener
<p>Semi-alias of addListener. It will add a listener that will be<br />automatically removed after it's first execution.</p>
<p>Semi-alias of addListener. It will add a listener that will be<br />automatically removed after its first execution.</p>
* **param** (String | RegExp) _evt_ - Name of the event to attach the listener to.
* **param** (StringRegExp) _evt_ - Name of the event to attach the listener to.
* **param** (Function) _listener_ - Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
* **return** (Object) - Current instance of EventEmitter for chaining.
## once

@@ -65,10 +58,8 @@

## defineEvent
<p>Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.<br />You need to tell it what event names should be matched by a regex.</p>
<p>Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don&#39;t do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.<br />You need to tell it what event names should be matched by a regex.</p>
* **param** (String) _evt_ - Name of the event to create.
* **return** (Object) - Current instance of EventEmitter for chaining.
## defineEvents

@@ -80,3 +71,2 @@

* **return** (Object) - Current instance of EventEmitter for chaining.
## removeListener

@@ -86,6 +76,5 @@

* **param** (String | RegExp) _evt_ - Name of the event to remove the listener from.
* **param** (StringRegExp) _evt_ - Name of the event to remove the listener from.
* **param** (Function) _listener_ - Method to remove from the event.
* **return** (Object) - Current instance of EventEmitter for chaining.
## off

@@ -95,11 +84,9 @@

## addListeners
<p>Adds listeners in bulk using the manipulateListeners method.<br />If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.<br />You can also pass it a regular expression to add the array of listeners to all events that match it.<br />Yeah, this function does quite a bit. That's probably a bad thing.</p>
<p>Adds listeners in bulk using the manipulateListeners method.<br />If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.<br />You can also pass it a regular expression to add the array of listeners to all events that match it.<br />Yeah, this function does quite a bit. That&#39;s probably a bad thing.</p>
* **param** (String | Object | RegExp) _evt_ - An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.
* **param** (StringObjectRegExp) _evt_ - An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.
* **param** (Function[]) _[listeners]_ - An optional array of listener functions to add.
* **return** (Object) - Current instance of EventEmitter for chaining.
## removeListeners

@@ -109,6 +96,5 @@

* **param** (String | Object | RegExp) _evt_ - An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.
* **param** (StringObjectRegExp) _evt_ - An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.
* **param** (Function[]) _[listeners]_ - An optional array of listener functions to remove.
* **return** (Object) - Current instance of EventEmitter for chaining.
## manipulateListeners

@@ -119,6 +105,5 @@

* **param** (Boolean) _remove_ - True if you want to remove listeners, false if you want to add.
* **param** (String | Object | RegExp) _evt_ - An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.
* **param** (StringObjectRegExp) _evt_ - An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.
* **param** (Function[]) _[listeners]_ - An optional array of listener functions to add/remove.
* **return** (Object) - Current instance of EventEmitter for chaining.
## removeEvent

@@ -128,12 +113,8 @@

* **param** (String | RegExp) _[evt]_ - Optional name of the event to remove all listeners for. Will remove from every event if not passed.
* **param** (StringRegExp) _[evt]_ - Optional name of the event to remove all listeners for. Will remove from every event if not passed.
* **return** (Object) - Current instance of EventEmitter for chaining.
## removeAllListeners
<p>Alias of removeEvent.</p>
<p>Alias of removeEvent.</p><p>Added to mirror the node API.</p>
<p>Added to mirror the node API.</p>
## emitEvent

@@ -143,6 +124,5 @@

* **param** (String | RegExp) _evt_ - Name of the event to emit and execute listeners for.
* **param** (StringRegExp) _evt_ - Name of the event to emit and execute listeners for.
* **param** (Array) _[args]_ - Optional array of arguments to be passed to each listener.
* **return** (Object) - Current instance of EventEmitter for chaining.
## trigger

@@ -152,3 +132,2 @@

## emit

@@ -158,6 +137,5 @@

* **param** (String | RegExp) _evt_ - Name of the event to emit and execute listeners for.
* **param** (StringRegExp) _evt_ - Name of the event to emit and execute listeners for.
* **param** (...*) _Optional_ - additional arguments to be passed to each listener.
* **return** (Object) - Current instance of EventEmitter for chaining.
## setOnceReturnValue

@@ -169,3 +147,2 @@

* **return** (Object) - Current instance of EventEmitter for chaining.
## noConflict

@@ -172,0 +149,0 @@

@@ -61,8 +61,14 @@ # Guide

### node.js
### node.js or Browser via Browserify
This is pretty simple, just require the file and load the `EventEmitter` attribute out of it.
This is pretty simple, just install the file via npm (or bower):
```bash
npm install wolfy87-eventemitter --save
```
...and then require it (if you used bower you have to require the relative path to the bower component)
```javascript
var EventEmitter = require('./assets/js/EventEmitter').EventEmitter;
var EventEmitter = require('wolfy87-eventemitter');
var ee = new EventEmitter();

@@ -296,2 +302,2 @@ ```

ee.emitEvent(/ba[rz]/);
```
```
/*!
* EventEmitter v4.2.7 - git.io/ee
* EventEmitter v4.2.8 - git.io/ee
* Oliver Caldwell

@@ -25,3 +25,3 @@ * MIT license

/**
* Finds the index of the listener for the event in it's storage array.
* Finds the index of the listener for the event in its storage array.
*

@@ -157,3 +157,3 @@ * @param {Function[]} listeners Array of listeners to search through.

* Semi-alias of addListener. It will add a listener that will be
* automatically removed after it's first execution.
* automatically removed after its first execution.
*

@@ -280,3 +280,3 @@ * @param {String|RegExp} evt Name of the event to attach the listener to.

// If evt is an object then pass each of it's properties to this method
// If evt is an object then pass each of its properties to this method
if (typeof evt === 'object' && !(evt instanceof RegExp)) {

@@ -283,0 +283,0 @@ for (i in evt) {

/*!
* EventEmitter v4.2.7 - git.io/ee
* EventEmitter v4.2.8 - git.io/ee
* Oliver Caldwell

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

{
"name": "wolfy87-eventemitter",
"version": "4.2.7",
"version": "4.2.8",
"description": "Event based JavaScript for the browser",

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

@@ -47,4 +47,3 @@ (function () {

test('allows you to fetch listeners by regex', function ()
{
test('allows you to fetch listeners by regex', function () {
var check = [];

@@ -126,4 +125,3 @@

test('allows you to add listeners by regex', function ()
{
test('allows you to add listeners by regex', function () {
var check = [];

@@ -138,2 +136,17 @@

});
test('prevents you from adding duplicate listeners', function () {
var count = 0;
function adder() {
count += 1;
}
ee.addListener('foo', adder);
ee.addListener('foo', adder);
ee.addListener('foo', adder);
ee.emitEvent('foo');
assert.strictEqual(count, 1);
});
});

@@ -357,4 +370,3 @@

test('removes listeners when passed a regex', function ()
{
test('removes listeners when passed a regex', function () {
var check = [];

@@ -500,4 +512,3 @@ ee.removeEvent();

test('executes all listeners that match a regular expression', function ()
{
test('executes all listeners that match a regular expression', function () {
var check = [];

@@ -513,4 +524,3 @@

test('global object is defined', function()
{
test('global object is defined', function() {
ee.addListener('foo', function() {

@@ -638,4 +648,3 @@ assert.equal(this, ee);

test('allows you to add listeners by regex', function ()
{
test('allows you to add listeners by regex', function () {
var check = [];

@@ -642,0 +651,0 @@

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