Eventemitter

This commit is contained in:
Jiiks 2018-01-15 06:29:06 +02:00
parent 9ecb14ab23
commit c851d2e92c
2 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,31 @@
/**
* BetterDiscord Events
* Copyright (c) 2015-present JsSucks - https://github.com/JsSucks
* All rights reserved.
* https://github.com/JsSucks - https://betterdiscord.net
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const { EventEmitter } = require('events');
const emitter = new EventEmitter();
class Events {
static on(eventName, callBack) {
emitter.on(eventName, callBack);
}
static off(eventName, callBack) {
emitter.removeListener(eventName, callBack);
}
static emit(...args) {
emitter.emit(...args);
}
}
module.exports = Events;

View File

@ -3,4 +3,5 @@ export { PluginManager } from './pluginmanager';
export { Pluging } from './plugin';
export { BDIpc } from './bdipc';
export { WebpackModules } from './webpackmodules';
export { Global } from './global';
export { Global } from './global';
export { Events } from './events';