{} convention, logs, exit and hook skeleton

This commit is contained in:
Jiiks 2016-10-31 18:05:51 +02:00
parent fc53df5e4b
commit 7f5986aa01
1 changed files with 24 additions and 4 deletions

View File

@ -32,6 +32,8 @@ const _defaults = {
class Core {
constructor(args) {
this.continue = true;
_logger.log(`v${this.__version} Loading - OS: ${_os.platform()}`);
this.initConfig(args.cfg);
}
@ -42,6 +44,24 @@ class Core {
_cfg.emotesEnabled = args.emotesEnabled || _defaults.emotesEnabled;
}
hook(mainWindow) {
if(mainWindow === undefined) {
this.exit("mainWindow is undefined!");
return;
}
}
exit(reason, severity) {
this.continue = false;
// TODO show an actual error dialog for user
_logger.log(`Quitting. Reason: ${reason}`, severity || 2);
_logger.save();
}
get __version() {
return _config.core.version;
}
}
exports.BetterDiscord = new Core({ cfg: { } });