Pause Function

Home

This simple function will pause code execution when called. After the specified time has elapsed, execution will continue.

function CIpause(ms) { // pauses for (at least) specified number of milliseconds
  var dateObj1 = new Date()
  var time2 = 0
  var time1 = dateObj1.getTime()
  while (time2 < ( time1 + ms) ) {
    var dateObj2 = new Date()
    time2 = dateObj2.getTime()
  }
}