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
@ -41,18 +55,32 @@ class Shared {
}
/**
* List of possible game engines used for development.
* @returns {String[]}
* @returns @returns {Object<number, string>}
*/
static get engines() {
return this.#_engines;
}
/**
* List of possible development states that a game can assume.
* @returns {String[]}
* @returns {Object<number, string>}
*/
static get statuses() {
return this.#_statuses;
}
/**
* 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}
@ -60,6 +88,12 @@ class Shared {
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;
}