diff --git a/src/classes/Chapter.ts b/src/classes/Chapter.ts index c4c2cb8..bfa4116 100644 --- a/src/classes/Chapter.ts +++ b/src/classes/Chapter.ts @@ -86,6 +86,12 @@ export default class Chapter { await this.populateText(); } + // deletes our #document if we want to clean up memory and not use a shitton + freeDocument() { + //completely sane behaviour + this.#document = undefined as unknown as HTMLDocument; + } + populateMetadata() { this.#name = this.#document.querySelector("h3.title")?.innerText .replace( diff --git a/src/classes/Work.ts b/src/classes/Work.ts index 2049ae6..6cfdc7c 100644 --- a/src/classes/Work.ts +++ b/src/classes/Work.ts @@ -63,6 +63,12 @@ export default class Work { await this.populateChapters(); } + // deletes our #document if we want to clean up memory and not use a shitton + freeDocument() { + //completely sane behaviour + this.#document = undefined as unknown as HTMLDocument; + } + populateMetadata() { this.name = (this.#document.querySelector("h2.title") as Element) .innerText.trim();