add global getters

This commit is contained in:
Jiiks 2018-03-19 13:45:20 -03:00
parent e1456f530c
commit 01b7e81f44
4 changed files with 16 additions and 4 deletions

View File

@ -44,7 +44,7 @@ export default class {
* returns {String} * returns {String}
*/ */
static get contentPath() { static get contentPath() {
return this._contentPath ? this._contentPath : (this._contentPath = Globals.getObject('paths').find(path => path.id === this.pathId).path); return Globals.getPath(this.pathId);
} }
/** /**

View File

@ -63,4 +63,16 @@ export default new class extends Module {
return this.state[name]; return this.state[name];
} }
getPath(id) {
return this.state.paths.find(path => path.id === id).path;
}
static get paths() {
return this.state.paths;
}
static get version() {
return this.state.version;
}
} }

View File

@ -133,6 +133,6 @@ export default new class Settings {
} }
get dataPath() { get dataPath() {
return this._dataPath ? this._dataPath : (this._dataPath = Globals.getObject('paths').find(p => p.id === 'data').path); return Globals.getPath('data');
} }
} }

View File

@ -48,8 +48,8 @@ export default class {
try { try {
Events.emit('update-check-end'); Events.emit('update-check-end');
Logger.info('Updater', Logger.info('Updater',
`Latest Version: ${e.version} - Current Version: ${Globals.getObject('version')}`); `Latest Version: ${e.version} - Current Version: ${Globals.version}`);
if (e.version !== Globals.getObject('version')) { if (e.version !== Globals.version) {
this.updatesAvailable = true; this.updatesAvailable = true;
Events.emit('updates-available'); Events.emit('updates-available');
} }