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

@hackdonalds/emitter

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hackdonalds/emitter - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

29

dist/index.js

@@ -1,3 +0,6 @@

export default class Emitter {
constructor(listeners = {}) {
"use strict";
exports.__esModule = true;
var Emitter = /** @class */ (function () {
function Emitter(listeners) {
if (listeners === void 0) { listeners = {}; }
this.listeners = listeners;

@@ -12,6 +15,6 @@ this.listeners = listeners;

*/
on(type, handler) {
Emitter.prototype.on = function (type, handler) {
this.listeners[type] = this.listeners[type] || [];
this.listeners[type].push(handler);
}
};
/**

@@ -23,7 +26,7 @@ * Remove an event handler for the given type.

*/
off(type, handler) {
Emitter.prototype.off = function (type, handler) {
if (this.listeners[type]) {
this.listeners[type].splice(this.listeners[type].indexOf(handler) >>> 0, 1);
}
}
};
/**

@@ -38,10 +41,12 @@ * Invoke this.listeners handlers for the given type.

*/
emit(type, evt) {
(this.listeners[type] || []).slice().map((handler) => { handler(evt); });
(this.listeners['*'] || []).slice().map((handler) => { handler(type, evt); });
}
}
Emitter.prototype.emit = function (type, evt) {
(this.listeners[type] || []).slice().map(function (handler) { handler(evt); });
(this.listeners['*'] || []).slice().map(function (handler) { handler(type, evt); });
};
return Emitter;
}());
exports["default"] = Emitter;
if (typeof window !== "undefined") {
window.HackDonalds = { Emitter };
window.HackDonalds = { Emitter: Emitter };
}
//# sourceMappingURL=index.js.map

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

"keywords": ["event", "emitter", "isomorphic", "events", "nodejs", "Javascript", "mitt", "eventemitter"],
"version": "0.3.0",
"version": "0.4.0",
"main": "dist/index.js",

@@ -8,0 +8,0 @@ "files": ["dist","README.md","src"],

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