fix it again?

This commit is contained in:
MathMan05 2024-09-10 09:48:01 -05:00
parent ee9483f350
commit baa224ab91
2 changed files with 21 additions and 12 deletions

View file

@ -286,17 +286,22 @@ class InfiniteScroller {
} }
} }
async delete() { async delete() {
for (const thing of this.HTMLElements) { if (this.div) {
await this.destroyFromID(thing[1]); 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 = []; this.HTMLElements = [];
if (this.timeout) { if (this.timeout) {
clearTimeout(this.timeout); clearTimeout(this.timeout);
} }
if (this.div) {
this.div.remove();
}
this.div = null;
} }
} }
export { InfiniteScroller }; export { InfiniteScroller };

View file

@ -277,17 +277,21 @@ class InfiniteScroller{
} }
} }
async delete():Promise<void>{ async delete():Promise<void>{
for(const thing of this.HTMLElements){ if(this.div){
await this.destroyFromID(thing[1]); 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=[]; this.HTMLElements=[];
if(this.timeout){ if(this.timeout){
clearTimeout(this.timeout); clearTimeout(this.timeout);
} }
if(this.div){
this.div.remove();
}
this.div=null;
} }
} }
export{InfiniteScroller}; export{InfiniteScroller};