1

I am trying to make a Tapermonkeyscript, but someway the function opens itself way to often - it should do it every second - start and end are time stamps, so somehow the timeout isn't working right and I don't see the problem - can anyone please help?

function redefine(a) {
  var start = parent.mainFrame.start; //get start
  var end = parent.mainFrame.end; //get end
  var points = new Array(1, 2, 6, 3, 7, 3, 5, 3); //set array
  if (end - start <= 1) { //check if ready
    parent.mainFrame.setPoint(points[a]); //redefine point
    a = a + 1; //nextpoint
  }
  window.setTimeout(redefine(a), 1000); //check again in 1s for points
}
redefine(0);

Regards, basicn00b

t.niese
  • 39,256
  • 9
  • 74
  • 101
basicn00b
  • 27
  • 7

0 Answers0