Implements ILazy interface

pull/77/head
MillenniumEarl 2021-03-10 10:06:44 +01:00
parent 1b7cf2b85a
commit 2ab470b25e
4 changed files with 18 additions and 4 deletions

View File

@ -15,11 +15,12 @@ import { fetchHTML } from "../../network-helper";
import { GENERIC, MEMBER } from "../../constants/css-selector"; import { GENERIC, MEMBER } from "../../constants/css-selector";
import shared from "../../shared"; import shared from "../../shared";
import { UserNotLogged, USER_NOT_LOGGED } from "../errors"; import { UserNotLogged, USER_NOT_LOGGED } from "../errors";
import { ILazy } from "../../interfaces";
/** /**
* Represents a generic user registered on the platform. * Represents a generic user registered on the platform.
*/ */
export default class PlatformUser { export default class PlatformUser implements ILazy {
//#region Fields //#region Fields
private _id: number; private _id: number;

View File

@ -16,11 +16,12 @@ import { urls } from "../../constants/url";
import { fetchHTML } from "../../network-helper"; import { fetchHTML } from "../../network-helper";
import shared from "../../shared"; import shared from "../../shared";
import { UserNotLogged, USER_NOT_LOGGED } from "../errors"; import { UserNotLogged, USER_NOT_LOGGED } from "../errors";
import { ILazy } from "../../interfaces";
/** /**
* Represents a post published by a user on the F95Zone platform. * Represents a post published by a user on the F95Zone platform.
*/ */
export default class Post { export default class Post implements ILazy {
//#region Fields //#region Fields
private _id: number; private _id: number;

View File

@ -12,7 +12,7 @@ import { DateTime } from "luxon";
// Modules from files // Modules from files
import Post from "./post"; import Post from "./post";
import PlatformUser from "./platform-user"; import PlatformUser from "./platform-user";
import { TCategory, TRating } from "../../interfaces"; import { ILazy, TCategory, TRating } from "../../interfaces";
import { urls } from "../../constants/url"; import { urls } from "../../constants/url";
import { POST, THREAD } from "../../constants/css-selector"; import { POST, THREAD } from "../../constants/css-selector";
import { fetchHTML, fetchPOSTResponse } from "../../network-helper"; import { fetchHTML, fetchPOSTResponse } from "../../network-helper";
@ -31,7 +31,7 @@ import shared from "../../shared";
/** /**
* Represents a generic F95Zone platform thread. * Represents a generic F95Zone platform thread.
*/ */
export default class Thread { export default class Thread implements ILazy {
//#region Fields //#region Fields
private POST_FOR_PAGE = 20; private POST_FOR_PAGE = 20;

View File

@ -316,3 +316,15 @@ export interface IQuery {
*/ */
execute(): any; execute(): any;
} }
/**
* It represents an object that obtains the data
* only on the explicit request of the user and
* only after its establishment.
*/
export interface ILazy {
/**
* Gets the data relating to the object.
*/
fetch(): Promise<void>;
}