Comparing version 1.0.2-1626779281664 to 1.0.2-1626780376817
@@ -1,9 +0,9 @@ | ||
var EventEmitter = /** @class */ (function () { | ||
function EventEmitter() { | ||
export class EventEmitter { | ||
constructor() { | ||
this.events = new Map(); | ||
} | ||
EventEmitter.prototype.emit = function (event, msg) { | ||
var listeners = this.events.get(event) || []; | ||
for (var i = listeners.length - 1; i >= 0; i--) { | ||
var listener = listeners[i]; | ||
emit(event, msg) { | ||
const listeners = this.events.get(event) || []; | ||
for (let i = listeners.length - 1; i >= 0; i--) { | ||
const listener = listeners[i]; | ||
listener.cb(msg); | ||
@@ -14,8 +14,8 @@ if (listener.once) { | ||
} | ||
}; | ||
EventEmitter.prototype.emitAsync = function (event, msg) { | ||
var listeners = this.events.get(event) || []; | ||
setTimeout(function () { | ||
for (var i = listeners.length - 1; i >= 0; i--) { | ||
var listener = listeners[i]; | ||
} | ||
emitAsync(event, msg) { | ||
const listeners = this.events.get(event) || []; | ||
setTimeout(() => { | ||
for (let i = listeners.length - 1; i >= 0; i--) { | ||
const listener = listeners[i]; | ||
listener.cb(msg); | ||
@@ -27,20 +27,18 @@ if (listener.once) { | ||
}); | ||
}; | ||
EventEmitter.prototype.on = function (event, cb) { | ||
} | ||
on(event, cb) { | ||
this.addListener(event, cb, false); | ||
}; | ||
EventEmitter.prototype.once = function (event, cb) { | ||
} | ||
once(event, cb) { | ||
this.addListener(event, cb, true); | ||
}; | ||
EventEmitter.prototype.addListener = function (event, cb, once) { | ||
var listeners = this.events.get(event) || []; | ||
} | ||
addListener(event, cb, once) { | ||
const listeners = this.events.get(event) || []; | ||
listeners.push({ | ||
once: once, | ||
cb: cb, | ||
once, | ||
cb, | ||
}); | ||
this.events.set(event, listeners); | ||
}; | ||
return EventEmitter; | ||
}()); | ||
export { EventEmitter }; | ||
} | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "betsy", | ||
"version": "1.0.2-1626779281664", | ||
"version": "1.0.2-1626780376817", | ||
"description": "Typed events", | ||
@@ -14,3 +14,3 @@ "author": "Christian Alfoni <christianalfoni@gmail.com>", | ||
"build:lib": "tsc --outDir lib --module commonjs", | ||
"build:es": "tsc --outDir es --module es2015", | ||
"build:es": "tsc --outDir es --module ES2020 --target ES2020", | ||
"clean": "rimraf es lib coverage", | ||
@@ -17,0 +17,0 @@ "typecheck": "tsc --noEmit", |
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
10147
111