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

@evergis/event-emitter

Package Overview
Dependencies
Maintainers
6
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@evergis/event-emitter - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

dist/EventEmitter.d.ts

83

dist/event-emitter.cjs.development.js

@@ -5,79 +5,14 @@ 'use strict';

function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var EventEmitter_ts = require('EventEmitter.ts');
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var EventEmitter = /*#__PURE__*/function () {
function EventEmitter() {
_classCallCheck(this, EventEmitter);
this.handlers = {
'*': []
};
}
_createClass(EventEmitter, [{
key: "on",
value: function on(type, handler) {
if (!this.handlers[type]) {
this.handlers[type] = [];
}
this.handlers[type].push(handler);
}
}, {
key: "off",
value: function off(type, handler) {
if (!this.handlers[type]) return;
var index = this.handlers[type].indexOf(handler);
if (index === -1) return;
this.handlers[type].splice(index, 1);
}
}, {
key: "emit",
value: function emit(type, event) {
this.handlers[type] && this.handlers[type].map(function (handler) {
return handler(event);
});
this.handlers['*'].map(function (handler) {
return handler(type, event);
});
}
}, {
key: "once",
value: function once(type, handler) {
var _this = this;
var onceHandler = function onceHandler(event) {
_this.off(type, onceHandler);
handler(event);
};
this.on(type, onceHandler);
}
}]);
return EventEmitter;
}();
exports.EventEmitter = EventEmitter;
Object.keys(EventEmitter_ts).forEach(function (k) {
if (k !== 'default') Object.defineProperty(exports, k, {
enumerable: true,
get: function () {
return EventEmitter_ts[k];
}
});
});
//# sourceMappingURL=event-emitter.cjs.development.js.map

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EventEmitter=function(){function e(){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.handlers={"*":[]}}var n;return(n=[{key:"on",value:function(e,n){this.handlers[e]||(this.handlers[e]=[]),this.handlers[e].push(n)}},{key:"off",value:function(e,n){if(this.handlers[e]){var t=this.handlers[e].indexOf(n);-1!==t&&this.handlers[e].splice(t,1)}}},{key:"emit",value:function(e,n){this.handlers[e]&&this.handlers[e].map((function(e){return e(n)})),this.handlers["*"].map((function(t){return t(e,n)}))}},{key:"once",value:function(e,n){var t=this;this.on(e,(function r(i){t.off(e,r),n(i)}))}}])&&function(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,n),e}();
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("EventEmitter.ts");Object.keys(e).forEach((function(t){"default"!==t&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}));
//# sourceMappingURL=event-emitter.cjs.production.min.js.map

@@ -1,78 +0,2 @@

function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var EventEmitter = /*#__PURE__*/function () {
function EventEmitter() {
_classCallCheck(this, EventEmitter);
this.handlers = {
'*': []
};
}
_createClass(EventEmitter, [{
key: "on",
value: function on(type, handler) {
if (!this.handlers[type]) {
this.handlers[type] = [];
}
this.handlers[type].push(handler);
}
}, {
key: "off",
value: function off(type, handler) {
if (!this.handlers[type]) return;
var index = this.handlers[type].indexOf(handler);
if (index === -1) return;
this.handlers[type].splice(index, 1);
}
}, {
key: "emit",
value: function emit(type, event) {
this.handlers[type] && this.handlers[type].map(function (handler) {
return handler(event);
});
this.handlers['*'].map(function (handler) {
return handler(type, event);
});
}
}, {
key: "once",
value: function once(type, handler) {
var _this = this;
var onceHandler = function onceHandler(event) {
_this.off(type, onceHandler);
handler(event);
};
this.on(type, onceHandler);
}
}]);
return EventEmitter;
}();
export { EventEmitter };
export * from 'EventEmitter.ts';
//# sourceMappingURL=event-emitter.esm.js.map

@@ -1,1 +0,1 @@

export { EventEmitter } from "./event-emitter";
export * from "EventEmitter.ts";
{
"version": "1.1.0",
"version": "1.1.1",
"license": "MIT",

@@ -4,0 +4,0 @@ "main": "dist/index.js",

@@ -1,1 +0,1 @@

export { EventEmitter } from "./event-emitter";
export * from "EventEmitter.ts";

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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