export default function throttle(fn, threshhold, context) {
  var last;
  var deferTimer;
  var boundFn = fn.bind(context);
  return function () {
    var now = Date.now();
    var args = Array.prototype.slice.call(arguments);
    if (last && now < last + threshhold) {
      // hold on to it
      clearTimeout(deferTimer);
      deferTimer = setTimeout(function () {
        last = now;
        boundFn.apply(null, args);
      }, threshhold);
    } else {
      last = now;
      boundFn.apply(null, args);
    }
  };
}