Skip to content

Commit

Permalink
raidboss: fix errors on delayed triggers being cancelled (#5912)
Browse files Browse the repository at this point in the history
Fixes #5153.
  • Loading branch information
quisquous authored Nov 9, 2023
1 parent 2cc271d commit 9f32885
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ui/raidboss/popup-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ const isWipe = (line: string): boolean => {
export class PopupText {
protected triggers: ProcessedTrigger[] = [];
protected netTriggers: ProcessedTrigger[] = [];
protected timers: { [triggerId: number]: boolean } = {};
// A map of trigger id to setTimeout handle.
protected timers: { [triggerId: number]: number } = {};
protected triggerSuppress: { [triggerId: string]: number } = {};
protected currentTriggerID = 0;
protected inCombat = false;
Expand Down Expand Up @@ -1048,6 +1049,8 @@ export class PopupText {
}

StopTimers(): void {
for (const handle of Object.values(this.timers))
window.clearTimeout(handle);
this.timers = {};
}

Expand Down Expand Up @@ -1334,9 +1337,8 @@ export class PopupText {
return;

const triggerID = this.currentTriggerID++;
this.timers[triggerID] = true;
return new Promise((res, rej) => {
window.setTimeout(() => {
this.timers[triggerID] = window.setTimeout(() => {
if (this.timers[triggerID])
res();
else
Expand Down

0 comments on commit 9f32885

Please sign in to comment.