Set fields as private
parent
e5cdb9f65d
commit
9e533d56f1
|
@ -19,65 +19,46 @@ type TPrefixKey = "engines" | "statuses" | "tags" | "others";
|
|||
* Class containing variables shared between modules.
|
||||
*/
|
||||
export default abstract class Shared {
|
||||
//#region Properties
|
||||
/**
|
||||
* Indicates whether a user is logged in to the F95Zone platform or not.
|
||||
*/
|
||||
static _isLogged = false;
|
||||
/**
|
||||
* List of platform prefixes and tags.
|
||||
*/
|
||||
static _prefixes: { [key in TPrefixKey]: TPrefixDict } = {} as { [key in TPrefixKey]: TPrefixDict };
|
||||
/**
|
||||
* Logger object used to write to both file and console.
|
||||
*/
|
||||
static _logger: log4js.Logger = log4js.getLogger();
|
||||
/**
|
||||
* Session on the F95Zone platform.
|
||||
*/
|
||||
static _session = new Session(join(tmpdir(), "f95session.json"));
|
||||
//#endregion Properties
|
||||
|
||||
//#region Fields
|
||||
|
||||
private static _isLogged = false;
|
||||
private static _prefixes: { [key in TPrefixKey]: TPrefixDict } = {} as { [key in TPrefixKey]: TPrefixDict };
|
||||
private static _logger: log4js.Logger = log4js.getLogger();
|
||||
private static _session = new Session(join(tmpdir(), "f95session.json"));
|
||||
|
||||
//#endregion Fields
|
||||
|
||||
//#region Getters
|
||||
|
||||
/**
|
||||
* Indicates whether a user is logged in to the F95Zone platform or not.
|
||||
*/
|
||||
static get isLogged(): boolean {
|
||||
return this._isLogged;
|
||||
}
|
||||
static get isLogged(): boolean { return this._isLogged; }
|
||||
/**
|
||||
* List of platform prefixes and tags.
|
||||
*/
|
||||
static get prefixes(): { [s: string]: TPrefixDict } {
|
||||
return this._prefixes;
|
||||
}
|
||||
static get prefixes(): { [s: string]: TPrefixDict } { return this._prefixes; }
|
||||
/**
|
||||
* Logger object used to write to both file and console.
|
||||
*/
|
||||
static get logger(): log4js.Logger {
|
||||
return this._logger;
|
||||
}
|
||||
static get logger(): log4js.Logger { return this._logger; }
|
||||
/**
|
||||
* Path to the cache used by this module wich contains engines, statuses, tags...
|
||||
*/
|
||||
static get cachePath(): string {
|
||||
return join(tmpdir(), "f95cache.json");
|
||||
}
|
||||
static get cachePath(): string { return join(tmpdir(), "f95cache.json"); }
|
||||
/**
|
||||
* Session on the F95Zone platform.
|
||||
*/
|
||||
static get session(): Session {
|
||||
return this._session;
|
||||
}
|
||||
static get session(): Session { return this._session; }
|
||||
|
||||
//#endregion Getters
|
||||
|
||||
//#region Setters
|
||||
static setPrefixPair(key: TPrefixKey, val: TPrefixDict): void {
|
||||
this._prefixes[key] = val;
|
||||
}
|
||||
|
||||
static setIsLogged(val: boolean): void {
|
||||
this._isLogged = val;
|
||||
}
|
||||
static setPrefixPair(key: TPrefixKey, val: TPrefixDict): void { this._prefixes[key] = val; }
|
||||
|
||||
static setIsLogged(val: boolean): void { this._isLogged = val; }
|
||||
|
||||
//#endregion Setters
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue