diff --git a/.dist/infiniteScroller.js b/.dist/infiniteScroller.js index c26b92f..3144019 100644 --- a/.dist/infiniteScroller.js +++ b/.dist/infiniteScroller.js @@ -286,17 +286,22 @@ class InfiniteScroller { } } async delete() { - for (const thing of this.HTMLElements) { - await this.destroyFromID(thing[1]); + if (this.div) { + this.div.remove(); + this.div = null; + } + try { + for (const thing of this.HTMLElements) { + await this.destroyFromID(thing[1]); + } + } + catch (e) { + console.error(e); } this.HTMLElements = []; if (this.timeout) { clearTimeout(this.timeout); } - if (this.div) { - this.div.remove(); - } - this.div = null; } } export { InfiniteScroller }; diff --git a/webpage/infiniteScroller.ts b/webpage/infiniteScroller.ts index 7a7988b..64339f5 100644 --- a/webpage/infiniteScroller.ts +++ b/webpage/infiniteScroller.ts @@ -277,17 +277,21 @@ class InfiniteScroller{ } } async delete():Promise{ - for(const thing of this.HTMLElements){ - await this.destroyFromID(thing[1]); + if(this.div){ + this.div.remove(); + this.div=null; + } + try{ + for(const thing of this.HTMLElements){ + await this.destroyFromID(thing[1]); + } + }catch(e){ + console.error(e); } this.HTMLElements=[]; if(this.timeout){ clearTimeout(this.timeout); } - if(this.div){ - this.div.remove(); - } - this.div=null; } } export{InfiniteScroller};