Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "es-emitter", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A small function that produces an emitter", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/blakelapierre/es-emitter", |
module.exports = () => { | ||
return listenerInterceptor => { | ||
var events = {}; | ||
const events = {}; | ||
@@ -13,6 +13,6 @@ return { | ||
function emit(events, event) { | ||
var listeners = events[event] || [], | ||
const listeners = events[event] || [], | ||
args = Array.prototype.slice.call(arguments, 2); | ||
for (var i = 0; i < listeners.length; i++) { | ||
for (let i = 0; i < listeners.length; i++) { | ||
listeners[i].apply(null, args); | ||
@@ -24,3 +24,3 @@ } | ||
if (typeof event == 'object') { | ||
var unregister = () => _.each(unregister, fn => fn()); | ||
const unregister = () => _.each(unregister, fn => fn()); | ||
return _.transform(event, (result, listener, eventName) => { | ||
@@ -32,3 +32,3 @@ result[eventName] = on(events, listenerInterceptor, eventName, listener); | ||
if (listenerInterceptor) { | ||
var ret = listenerInterceptor.attemptIntercept(event, listener); | ||
const ret = listenerInterceptor.attemptIntercept(event, listener); | ||
if (ret) return ret; | ||
@@ -45,7 +45,7 @@ } | ||
if (typeof event == 'object') { | ||
for (var eventName in event) off(events, eventName, event[eventName]); | ||
for (let eventName in event) off(events, eventName, event[eventName]); | ||
return; | ||
} | ||
var listeners = events[event]; | ||
const listeners = events[event]; | ||
if (listeners && listeners.length > 0) { | ||
@@ -57,3 +57,3 @@ removeListener(listeners, listener); | ||
function removeListener(listeners, listener) { | ||
for (var i = listeners.length - 1; i >= 0; i--) { | ||
for (let i = listeners.length - 1; i >= 0; i--) { | ||
if (listeners[i] === listener) { | ||
@@ -60,0 +60,0 @@ listeners.splice(i, 1); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
117208