Added 'tags' and 'others' fields

pull/57/head
MillenniumEarl 2020-12-03 11:34:33 +01:00
parent 0a49f922f5
commit f7bb2b36cd
1 changed files with 58 additions and 16 deletions

View File

@ -1,6 +1,10 @@
/* istanbul ignore file */
"use strict";
// Core modules
const {tmpdir} = require("os");
const {join} = require("path");
// Public modules from npm
const log4js = require("log4js");
@ -16,14 +20,24 @@ class Shared {
static #_isLogged = false;
/**
* List of possible game engines used for development.
* @type String[]
* @type Object<number,string>
*/
static #_engines = ["ADRIFT", "Flash", "HTML", "Java", "Others", "QSP", "RAGS", "RPGM", "Ren'Py", "Tads", "Unity", "Unreal Engine", "WebGL", "Wolf RPG"];
static #_engines = {};
/**
* List of possible development statuses that a game can assume.
* @type String[]
* @type Object<number,string>
*/
static #_statuses = ["Completed", "Onhold", "Abandoned"];
static #_statuses = {};
/**
* List of other prefixes that a game can assume.
* @type Object<number,string>
*/
static #_others = {};
/**
* List of possible tags that a game can assume.
* @type Object<number,string>
*/
static #_tags = {};
/**
* Logger object used to write to both file and console.
* @type log4js.Logger
@ -33,33 +47,53 @@ class Shared {
//#region Getters
/**
* Indicates whether a user is logged in to the F95Zone platform or not.
* @returns {Boolean}
*/
* Indicates whether a user is logged in to the F95Zone platform or not.
* @returns {Boolean}
*/
static get isLogged() {
return this.#_isLogged;
}
/**
* List of possible game engines used for development.
* @returns {String[]}
*/
* List of possible game engines used for development.
* @returns @returns {Object<number, string>}
*/
static get engines() {
return this.#_engines;
}
/**
* List of possible development states that a game can assume.
* @returns {String[]}
*/
* List of possible development states that a game can assume.
* @returns {Object<number, string>}
*/
static get statuses() {
return this.#_statuses;
}
/**
* Logger object used to write to both file and console.
* @returns {log4js.Logger}
*/
* List of other prefixes that a game can assume.
* @returns {Object<number, string>}
*/
static get others() {
return this.#_others;
}
/**
* List of possible tags that a game can assume.
* @returns {Object<number, string>}
*/
static get tags() {
return this.#_tags;
}
/**
* Logger object used to write to both file and console.
* @returns {log4js.Logger}
*/
static get logger() {
return this.#_logger;
}
/**
* Path to the cache used by this module wich contains engines, statuses, tags...
*/
static get cachePath() {
return join(tmpdir(), "f95cache.json");
}
//#endregion Getters
//#region Setters
@ -71,6 +105,14 @@ class Shared {
this.#_statuses = val;
}
static set tags(val) {
this.#_tags = val;
}
static set others(val) {
this.#_others = val;
}
static set isLogged(val) {
this.#_isLogged = val;
}