Add event structs

This commit is contained in:
Samuel Elliott 2018-02-13 22:18:09 +00:00
parent 13e9c53520
commit 1bded3121e
4 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,28 @@
/**
* BetterDiscord Base Event Struct
* Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
* All rights reserved.
* 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.
*/
export default class Event {
constructor(args) {
this.args = args;
this.__eventInfo = {
args: arguments,
type: this.__eventType
};
}
get event() {
return this.__eventInfo;
}
get __eventType() { return null; }
}

View File

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

View File

@ -0,0 +1,39 @@
/**
* BetterDiscord Setting Updated Event Struct
* Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
* All rights reserved.
* 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 Event from './event';
export default class SettingUpdatedEvent extends Event {
get set() {
return this.args.set_id;
}
get category() {
return this.args.category_id;
}
get setting() {
return this.args.setting_id;
}
get value() {
return this.args.value;
}
get old_value() {
return this.args.old_value;
}
get __eventType() {
return 'setting-updated';
}
}

View File

@ -1 +1,2 @@
export * from './error';
export * from './events/index';