lib/schedule.js
function excuteJob(){
  let job = peekNextJob();
  let nextJob;

  while(!!job && (job.excuteTime()-Date.now())<accuracy){
    job.run();
    queue.pop();

    let nextTime = job.nextTime();

    if(nextTime === null){
      delete map[job.id];
    }else{
      queue.offer({id:job.id, time: nextTime});
    }
    job = peekNextJob();
  }

  //If all the job have been canceled
  if(!job)
    return;

  //Run next schedule
  setTimer(job);
}
function excuteJob(){
  let job = peekNextJob();
  let nextJob;

  while(!!job && (job.excuteTime()-Date.now())<accuracy){
    job.run();
    queue.pop();

    let nextTime = job.nextTime();

    if(nextTime === null){
      delete map[job.id];
    }else{
      queue.offer({id:job.id, time: nextTime});
    }
    job = peekNextJob();
  }

  //If all the job have been canceled
  if(!job)
    return;

  //Run next schedule
  setTimer(job);
}
function excuteJob ( ) { let job = peekNextJob ( ) ; let nextJob ; while ( ! ! job && ( job . excuteTime ( ) - Date . now ( ) ) < accuracy ) { job . run ( ) ; queue . pop ( ) ; let nextTime = job . nextTime ( ) ; if ( nextTime === null ) { delete map [ job . id ] ; } else { queue . offer ( { id : job . id , time : nextTime } ) ; } job = peekNextJob ( ) ; } //If all the job have been canceled if ( ! job ) return ; //Run next schedule setTimer ( job ) ; }
The function used to ran the schedule job, and setTimeout for next running job
The function used to ran the schedule job and setTimeout for next running job