From 88ad25ecc720584113ad24bfb851eb3a4004fd3a Mon Sep 17 00:00:00 2001 From: Jiiks Date: Mon, 29 Jan 2018 19:46:24 +0200 Subject: [PATCH] add events module --- client/src/index.js | 1 - client/src/modules/events.js | 26 ++++++++++++++++++++++++++ client/src/modules/index.js | 1 + 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 client/src/modules/events.js create mode 100644 client/src/modules/index.js diff --git a/client/src/index.js b/client/src/index.js index f315648c..dc397565 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -13,7 +13,6 @@ import BdCss from './styles/index.scss'; class BetterDiscord { constructor() { - window.DOM = DOM; DOM.injectStyle(BdCss, 'bdmain'); } } diff --git a/client/src/modules/events.js b/client/src/modules/events.js new file mode 100644 index 00000000..e6c83e2b --- /dev/null +++ b/client/src/modules/events.js @@ -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); + } +} \ No newline at end of file diff --git a/client/src/modules/index.js b/client/src/modules/index.js new file mode 100644 index 00000000..0a82c9f5 --- /dev/null +++ b/client/src/modules/index.js @@ -0,0 +1 @@ +export { default as Events } from './events'; \ No newline at end of file