2017-11-04 12:23:46 +00:00
|
|
|
const { BaseApplication } = require('lib/BaseApplication');
|
|
|
|
const { Setting } = require('lib/models/setting.js');
|
|
|
|
const { BaseModel } = require('lib/base-model.js');
|
|
|
|
const { _ } = require('lib/locale.js');
|
|
|
|
const os = require('os');
|
|
|
|
const fs = require('fs-extra');
|
|
|
|
const { Logger } = require('lib/logger.js');
|
|
|
|
const { reg } = require('lib/registry.js');
|
|
|
|
const { sprintf } = require('sprintf-js');
|
|
|
|
const { JoplinDatabase } = require('lib/joplin-database.js');
|
|
|
|
const { DatabaseDriverNode } = require('lib/database-driver-node.js');
|
2017-11-04 12:38:53 +00:00
|
|
|
const { ElectronAppWrapper } = require('./ElectronAppWrapper');
|
2017-11-04 12:23:46 +00:00
|
|
|
|
|
|
|
class Application extends BaseApplication {
|
|
|
|
|
|
|
|
constructor(electronApp) {
|
|
|
|
super();
|
|
|
|
|
2017-11-04 12:38:53 +00:00
|
|
|
this.gui_ = new ElectronAppWrapper(electronApp);
|
2017-11-04 12:23:46 +00:00
|
|
|
}
|
|
|
|
|
2017-11-04 12:38:53 +00:00
|
|
|
gui() {
|
|
|
|
return this.gui_;
|
2017-11-04 12:23:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
async start(argv) {
|
|
|
|
argv = await super.start(argv);
|
|
|
|
|
2017-11-04 12:38:53 +00:00
|
|
|
await this.gui().start();
|
2017-11-04 12:23:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let application_ = null;
|
|
|
|
|
|
|
|
function app() {
|
|
|
|
if (!application_) throw new Error('Application has not been initialized');
|
|
|
|
return application_;
|
|
|
|
}
|
|
|
|
|
|
|
|
function initApp(electronApp) {
|
|
|
|
if (application_) throw new Error('Application has already been initialized');
|
|
|
|
application_ = new Application(electronApp);
|
|
|
|
return application_;
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = { app, initApp };
|