lib/temporal.js
function Task(entry) {
  if (!(this instanceof Task)) {
    return new Task(entry);
  }

  this.called = 0;
  this.now = this.calledAt = hrTime();

  if (resolutionDivisor !== DEFAULT_RESOLUTION) {
    entry.time = ~~(entry.time * (DEFAULT_RESOLUTION / resolutionDivisor));
  }

  // Side table property definitions
  this.isRunnable = true;
  this.later = this.now + entry.time;
  this.task = entry.task;
  this.type = entry.type;
  this.time = entry.time;

  if (this.later > gLast) {
    gLast = this.later;
  }

  if (!queue[this.later]) {
    queue[this.later] = [];
  }
  // console.log( entry.later, this );
  queue[this.later].push(this);
}
function Task(entry) {
  if (!(this instanceof Task)) {
    return new Task(entry);
  }

  this.called = 0;
  this.now = this.calledAt = hrTime();

  if (resolutionDivisor !== DEFAULT_RESOLUTION) {
    entry.time = ~~(entry.time * (DEFAULT_RESOLUTION / resolutionDivisor));
  }

  // Side table property definitions
  this.isRunnable = true;
  this.later = this.now + entry.time;
  this.task = entry.task;
  this.type = entry.type;
  this.time = entry.time;

  if (this.later > gLast) {
    gLast = this.later;
  }

  if (!queue[this.later]) {
    queue[this.later] = [];
  }
  // console.log( entry.later, this );
  queue[this.later].push(this);
}
function Task ( entry ) { if ( ! ( this instanceof Task ) ) { return new Task ( entry ) ; } this . called = 0 ; this . now = this . calledAt = hrTime ( ) ; if ( resolutionDivisor !== DEFAULT_RESOLUTION ) { entry . time = ~ ~ ( entry . time * ( DEFAULT_RESOLUTION / resolutionDivisor ) ) ; } // Side table property definitions this . isRunnable = true ; this . later = this . now + entry . time ; this . task = entry . task ; this . type = entry . type ; this . time = entry . time ; if ( this . later > gLast ) { gLast = this . later ; } if ( ! queue [ this . later ] ) { queue [ this . later ] = [ ] ; } // console.log( entry.later, this ); queue [ this . later ] . push ( this ) ; }
Task create a temporal task item
@param {Object} entry Options for entry {time, task}
Task create a temporal task item