An HTML parsing listener.

interface IHtmlParseListener {
    onEnd: () => void;
    onTagClose: () => void;
    onTagOpen: (name: string, attributes: Record<string, string>) => void;
    onText: (data: string) => void;
}

Properties

onEnd: () => void

Called when parsing has ended.

onTagClose: () => void

Called when a tag is closed.

onTagOpen: (name: string, attributes: Record<string, string>) => void

Called when a tag is opened.

Type declaration

    • (name: string, attributes: Record<string, string>): void
    • Parameters

      • name: string

        The tag name.

      • attributes: Record<string, string>

        A hash of attributes.

      Returns void

onText: (data: string) => void

Called when text contents are parsed. Note that this can be called multiple times per tag, when for example the string is spread over multiple chunks.

Type declaration

    • (data: string): void
    • Parameters

      • data: string

        A string.

      Returns void