add events module

This commit is contained in:
Jiiks 2018-01-29 19:46:24 +02:00
parent 4c5ff964e6
commit 88ad25ecc7
3 changed files with 27 additions and 1 deletions

View File

@ -13,7 +13,6 @@ import BdCss from './styles/index.scss';
class BetterDiscord {
constructor() {
window.DOM = DOM;
DOM.injectStyle(BdCss, 'bdmain');
}
}

View File

@ -0,0 +1,26 @@
/**
* BetterDiscord Events Module
* 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.
*/
import { EventEmitter } from 'events';
const emitter = new EventEmitter();
export default class {
static on(eventName, callBack) {
emitter.on(eventName, callBack);
}
static off(eventName, callBack) {
emitter.removeListener(eventName, callBack);
}
static emit(...args) {
emitter.emit(...args);
}
}

View File

@ -0,0 +1 @@
export { default as Events } from './events';