Set fields as private

pull/73/head
MillenniumEarl 2021-03-02 11:49:41 +01:00
parent e5cdb9f65d
commit 9e533d56f1
1 changed files with 20 additions and 39 deletions

View File

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