BetterDiscordApp-rauenzi/src/builtins/voicedisconnect.js

25 lines
646 B
JavaScript
Raw Normal View History

2019-05-31 07:53:11 +02:00
import Builtin from "../structs/builtin";
import {DiscordModules} from "modules";
export default new class DarkMode extends Builtin {
get name() {return "VoiceDisconnect";}
2019-06-06 06:28:43 +02:00
get category() {return "general";}
get id() {return "voiceDisconnect";}
2019-05-31 07:53:11 +02:00
constructor() {
super();
this.beforeUnload = this.beforeUnload.bind(this);
}
enabled() {
window.addEventListener("beforeunload", this.beforeUnload);
}
disabled() {
window.removeEventListener("beforeunload", this.beforeUnload);
}
beforeUnload() {
DiscordModules.ChannelActions.selectVoiceChannel(null, null);
}
};