FB3DOM - Litres/FB3Reader GitHub Wiki
Abstraction over tiny DOM-model. Implements top-level logic of data access
Defined in DOM/FB3DOMHead.ts file
Interface | Definition | Quick description |
---|---|---|
IFB3DOM |
interface IFB3DOM extends IFB3Block{
HyphOn: bool;
Progressor: FB3ReaderSite.ILoadProgress;
Alert: FB3ReaderSite.IAlert;
DataProvider: FB3DataProvider.IJsonLoaderFactory;
TOC: ITOC[];
DataChunks: IDataDisposition[];
Init(HyphOn: bool,
URL: string,
OnDone: IIFB3DOMReadyFunc);
GetHTMLAsync(HyphOn: bool,
Range: IRange,
Callback: IDOMTextReadyCallback): void;
} |
Top-level DOM class. Implements asynchronous yet transparent access to chunked book data. Gives any part of the document as an HTML-fragment with GetHTMLAsync . |
IFB3Block |
interface IFB3Block {
Parent: IFB3Block;
Chars: number;
ID: number;
TagName?: string;
GetXPID(): string;
GetHTML(HyphOn: bool, Range: IRange): InnerHTML;
} |
Basic DOM block (used for both tags and text fragments). Implements reconstruction of HTML from data tree. |
IRange |
export interface IRange {
From: number[];
To: number[];
} |
Range definition for HTML-fragment requests. |
IIFB3DOMReadyFunc |
interface IIFB3DOMReadyFunc{ (FB3DOM: IFB3DOM): void } |
Calling signature for IFB3DOM.Init callback. See IFB3DOM for more details. |
IDOMTextReadyCallback |
interface IDOMTextReadyCallback { (HTML: InnerHTML): void; } |
Calling signature for IFB3DOM.GetHTMLAsync callback. See IFB3DOM for more details. |
InnerHTML |
interface InnerHTML extends String {}; |
Just an alias for string, to keep track of where we expect plain text and where we expect html |
ITOC |
interface ITOC {
t?: string; // title
s: number; // start root node N
e: number; // end root node (including)
c?: ITOC[]; // contents (subitems)
} |
Definition of the JSON metadata, part Body (see JSON example in 120421.toc.js) |
IDataDisposition |
interface IDataDisposition {
s: number;
e: number;
url: string;
loaded: number; // 0 not loaded, 1 requested, 2 loaded
} |
Definition of the JSON metadata, description of data chunks. See JSON example in 120421.toc.js, Parts block. Additional field loaded is used during internal processing. |
Class | Implements | Quick description |
---|---|---|
FB3Tag | IFB3Block | Base tree tag. Can map itself (completely and partially) to HTML with GetHTML function |
FB3Text | IFB3Block | Text node implementation. Keep in mind: internally every word is a separate object. |
Defined in DOM/FB3DOM.ts file
Class | Implements | Quick description |
---|---|---|
DOM | IFB3DOM | Async, partyally loadable DOM implementation class. See interface description for more details. |