lib/index.js
function t(time, done) {
  if (arguments.length === 1) {
    done = time;
    time = 2000;
  }
  var error = new Error(`Callback took too long (max: ${time})`);
  var waiting = true;

  var timeout = setTimeout(function () {
    if (!waiting) return;
    waiting = false;
    done(error);
  }, time);

  function handler() {
    if (!waiting) return;
    clearTimeout(timeout);
    waiting = false;
    done.apply(this, arguments);
  }

  return handler;
}
function t(time, done) {
  if (arguments.length === 1) {
    done = time;
    time = 2000;
  }
  var error = new Error(`Callback took too long (max: ${time})`);
  var waiting = true;

  var timeout = setTimeout(function () {
    if (!waiting) return;
    waiting = false;
    done(error);
  }, time);

  function handler() {
    if (!waiting) return;
    clearTimeout(timeout);
    waiting = false;
    done.apply(this, arguments);
  }

  return handler;
}
function t ( time , done ) { if ( arguments . length === 1 ) { done = time ; time = 2000 ; } var error = new Error ( ` ${ time } ` ) ; var waiting = true ; var timeout = setTimeout ( function ( ) { if ( ! waiting ) return ; waiting = false ; done ( error ) ; } , time ) ; function handler ( ) { if ( ! waiting ) return ; clearTimeout ( timeout ) ; waiting = false ; done . apply ( this , arguments ) ; } return handler ; }
timeout for callbacks. Helps to kill misbehaving plugins, etc
timeout for callbacks . Helps to kill misbehaving plugins etc