{"size": 443, "ext": "js", "max_stars_repo_path": "lib/utilities/js/getTimer/index.js", "max_stars_repo_name": "opencolleges/oc-component-library", "max_stars_repo_stars_event_min_datetime": "2021-07-04T07:38:55.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-04T07:38:55.000Z", "max_issues_repo_path": "lib/utilities/js/getTimer/index.js", "max_issues_repo_name": "opencolleges/oc-component-library", "max_issues_repo_issues_event_min_datetime": "2021-03-08T23:17:13.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-10T16:00:23.000Z", "max_forks_repo_path": "lib/utilities/js/getTimer/index.js", "max_forks_repo_name": "opencolleges/oc-component-library", "max_forks_repo_forks_event_min_datetime": "2021-09-29T22:57:09.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-29T22:57:09.000Z"}
{"max_stars_count": 1, "max_issues_count": 3, "max_forks_count": 1, "avg_line_length": 17.72, "max_line_length": 53, "alphanum_fraction": 0.6365688488}
function getTimer(callback, delay) {
  let timerId,
    start,
    remaining = delay;

  this.pause = function() {
    window.clearTimeout(timerId);
    remaining -= Date.now() - start;
  };

  this.resume = function() {
    start = Date.now();
    window.clearTimeout(timerId);
    timerId = window.setTimeout(callback, remaining);
  };

  this.getTimerId = function() {
    return timerId;
  };

  this.resume();
}

export default getTimer;
