I wrote a broadcast picture with setInterval, but after running it for a period of time, the browser crashed.

The

code does not report an error, and the browser crashes after running for a period of time. The specific code is as follows:

carousel () {

    let self = this;
    if(!window.timer){
      this.carouselText = "";
      let oLen = this.substationTree.length;
      window.timer = setInterval(() => {
        self.carouselIndex = self.carouselIndex < oLen - 1 ? self.carouselIndex + 1 : 0;
        self.$set(self.substationTree[self.carouselIndex], "selected", true);
        self.selectedNode = Object.assign({}, self.substationTree[self.carouselIndex]);
        self.clickOnTreeNode([self.substationTree[self.carouselIndex]]);
      }, 5000);
    }else {
      this.carouselText = "";
      window.clearInterval(window.timer);
      window.timer = undefined;
    }
  }
May.22,2021

else {
      this.carouselText = "";
      window.clearInterval(window.timer);
      window.timer = undefined;
      setInterval(code, milliseconds);
    }

who will turn off this timer on the last line of this sentence?


it is correct that there is no problem with the above code. My problem is that I have to load the wiring diagram once after the rotation, and the wiring diagram will be refreshed each time, resulting in too much memory, which has been solved

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5adfd-455e0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5adfd-455e0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?