@palmares/events
Version:
This is the events framework for palmares, it's responsible for handling everything that is Pub/Sub like websockets, pub/sub like redis, and other types of asynchronous background tasks
40 lines (37 loc) • 1.36 kB
JavaScript
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
// src/emitter/exceptions.ts
var NotImplementedServerException = class _NotImplementedServerException extends Error {
static {
__name(this, "NotImplementedServerException");
}
constructor(serverName, methodName) {
super(`Method '${methodName}' was not implemented in '${serverName}' and it should be implemented in order to fully work.`);
this.name = _NotImplementedServerException.name;
}
};
// src/emitter/index.ts
var Emitter = class {
static {
__name(this, "Emitter");
}
// eslint-disable-next-line ts/require-await
static async new(...args) {
throw new NotImplementedServerException(this.name, "new");
}
// eslint-disable-next-line ts/require-await
async addEventListener(groupId, eventName, callback) {
throw new NotImplementedServerException(this.constructor.name, "addEventListener");
}
// eslint-disable-next-line ts/require-await
async removeEventListener(groupId, eventName, callback) {
throw new NotImplementedServerException(this.constructor.name, "unsubscribe");
}
// eslint-disable-next-line ts/require-await
async emit(groupId, eventName, ...data) {
throw new NotImplementedServerException(this.constructor.name, "emit");
}
};
export {
Emitter
};