31 lines
650 B
TypeScript
31 lines
650 B
TypeScript
|
import { Control, VoicemeeterType } from "./VMR/Control";
|
||
|
import { Logger } from "./Logger";
|
||
|
|
||
|
let control: Control;
|
||
|
let interval: NodeJS.Timeout;
|
||
|
const logger = new Logger({});
|
||
|
|
||
|
function exit() {
|
||
|
clearInterval(interval);
|
||
|
control.logout();
|
||
|
logger.log("Logout");
|
||
|
process.exit();
|
||
|
}
|
||
|
|
||
|
const exitEvents = [
|
||
|
{ name: "SIGINT" },
|
||
|
{ name: "SIGABRT" },
|
||
|
{ name: "SIGKILL" },
|
||
|
{ name: "SIGUSR1" },
|
||
|
{ name: "SIGUSR2" },
|
||
|
{ name: "beforeExit" },
|
||
|
{ name: "exit" },
|
||
|
{ name: "uncaughtException" },
|
||
|
{ name: "unhandledRejection" },
|
||
|
] as { name: NodeJS.Signals }[];
|
||
|
|
||
|
for (const event of exitEvents) {
|
||
|
process.on(event.name, exit.bind(null));
|
||
|
}
|
||
|
|