Updated JSDoc

pull/4/head
MillenniumEarl 2020-10-02 17:43:14 +02:00
parent 23c9d4cd08
commit 2cf963d765
3 changed files with 40 additions and 5 deletions

View File

@ -30,21 +30,42 @@ module.exports.UserData = UserData;
//#region Exposed properties
/**
*
* Shows log messages and other useful functions for module debugging.
* @param {Boolean} value
*/
module.exports.debug = function (value) {
shared.debug = value;
}
/**
* @public
* Indicates whether a user is logged in to the F95Zone platform or not.
* @returns {String}
*/
module.exports.isLogged = function () {
return shared.isLogged;
};
module.exports.isolation = function(value) {
/**
* @public
* If true, it opens a new browser for each request
* to the F95Zone platform, otherwise it reuses the same.
* @returns {String}
*/
module.exports.setIsolation = function(value) {
shared.isolation = value;
}
/**
* @public
* Path to the cache directory
* @returns {String}
*/
module.exports.getCacheDir = function() {
return shared.cacheDir;
}
/**
* @public
* Set path to the cache directory
* @returns {String}
*/
module.exports.setCacheDir = function(value) {
shared.cacheDir = value;
@ -222,6 +243,7 @@ module.exports.getGameData = async function (name, includeMods) {
/**
* @public
* Gets the data of the currently logged in user.
* You **must** be logged in to the portal before calling this method.
* @returns {Promise<UserData>} Data of the user currently logged in or null if an error arise
*/
module.exports.getUserData = async function () {
@ -265,7 +287,16 @@ module.exports.getUserData = async function () {
return ud;
}
/**
* @public
* Logout from the current user.
* You **must** be logged in to the portal before calling this method.
*/
module.exports.logout = function() {
if (!shared.isLogged) {
console.warn('user not authenticated, unable to continue');
return info.version;
}
shared.isLogged = false;
}
//#endregion

View File

@ -60,24 +60,28 @@ class Shared {
return this._debug;
}
/**
* @returns {boolean}
* Indicates whether a user is logged in to the F95Zone platform or not.
* @returns {Boolean}
*/
static get isLogged() {
return this._isLogged;
}
/**
* @returns {object[]}
* List of cookies obtained from the F95Zone platform.
* @returns {bject[]}
*/
static get cookies() {
return this._cookies;
}
/**
* List of possible game engines used for development.
* @returns {String[]}
*/
static get engines() {
return this._engines;
}
/**
* List of possible development states that a game can assume.
* @returns {String[]}
*/
static get statuses() {

View File

@ -10,7 +10,7 @@ const PASSWORD = "f9vTcRNuvxj4YpK";
const FAKE_USERNAME = "FakeUsername091276";
const FAKE_PASSWORD = "fake_password";
F95API.isolation(true);
F95API.setIsolation(true);
describe("Login without cookies", function () {
//#region Set-up