2017-04-15 16:32:44 +09:00
|
|
|
import {app} from 'electron';
|
|
|
|
import log from './log';
|
|
|
|
import startApp from './app';
|
|
|
|
import loadConfig from './config';
|
|
|
|
|
2017-04-18 20:29:07 +09:00
|
|
|
// default_app sets app.on('all-window-closed', () => app.quit()) before
|
|
|
|
// loading this application. We need to disable the callback.
|
|
|
|
app.removeAllListeners();
|
|
|
|
|
2017-04-15 16:32:44 +09:00
|
|
|
const appReady = new Promise<void>(resolve => app.once('ready', resolve));
|
|
|
|
|
|
|
|
process.on('unhandledRejection', (reason: string) => {
|
|
|
|
log.error('FATAL: Unhandled rejection! Reason:', reason);
|
|
|
|
});
|
|
|
|
|
|
|
|
app.on('will-quit', () => {
|
|
|
|
log.debug('Application is quitting');
|
|
|
|
});
|
|
|
|
|
|
|
|
Promise.all([
|
|
|
|
loadConfig(),
|
|
|
|
appReady
|
2017-04-18 20:29:07 +09:00
|
|
|
]).then(([config, _]) => startApp(config)).then(mstdn => {
|
|
|
|
mstdn.start();
|
2017-04-15 16:32:44 +09:00
|
|
|
log.debug('Application launched!');
|
|
|
|
});
|