@launchmenu/applet-dictionary
Version:
An applet to find dictionary definitions
83 lines • 3.11 kB
TypeScript
import { DataCacher, DataLoader, IDataHook } from "model-react";
import { WikiPage } from "./WikiPage";
import { IWikiSectionInfo } from "./_types/IWikiSectionInfo";
export declare class WikiSection {
protected page: WikiPage;
protected info: IWikiSectionInfo;
protected subsections: WikiSection[];
protected content: DataLoader<string | null, string>;
protected contentDom: DataCacher<Document | null>;
protected contentDomSource?: (h?: IDataHook) => Document | null;
/**
* Creates a new local model of a wikipage section
* @param page The page that this section is a part of
* @param info The section info
* @param subsections The ids of child sections
*/
constructor(page: WikiPage, info: IWikiSectionInfo, subsections?: WikiSection[]);
/**
* Retrieves the page that this section is a part of
* @returns The page
*/
getPage(): WikiPage;
/**
* Retrieves all subsections of this section
* @returns All subsections
*/
getSubSections(): WikiSection[];
/**
* Finds the subsections with the specified class
* @param constructor The class of the subsection to find
* @returns The subsections that were found
*/
protected findSubsections<T extends WikiSection>(constructor: {
new (...args: any[]): T;
}): T[];
/**
* Retrieves the depth of the section
* @returns The depth
*/
getLevel(): number;
/**
* Retrieves the name of the section
* @returns The section's name
*/
getName(): string;
/**
* Retrieves the non-hierarchical index of the section
* @returns The section's index
*/
getIndex(): number;
/**
* Retrieves the hierarchical id of the section, e.g. `1.3.2`
* @returns The hierarchical id
*/
getID(): string;
/**
* Retrieves the raw section content
* @param hook The hook to subscribe to changes
* @returns The currently loaded content of this section
*/
getContent(hook?: IDataHook): string | null;
/**
* Retrieves the section content parsed as an html document
* @param hook The hook to subscribe to changes
* @returns The currently loaded content of this section
*/
getContentDom(hook?: IDataHook): Document | null;
/**
* Sets the dom source in order to help with efficiency, prevents performing a data fetch if the data can be obtained from here
* @param source THe data source to retrieve the data from
*/
protected setContentDomSource(source: (hook?: IDataHook) => Document | null): void;
/**
* Sets the contents of the subsections based on the content of this section
*/
protected setSubsectionsContents(): void;
/**
* Sets the contents of the given subsection based on the content of this section
* @param subsection The subsection to set the content for
*/
protected setSubsectionContents(subsection: WikiSection): void;
}
//# sourceMappingURL=WikiSection.d.ts.map