{"size": 608, "ext": "js", "max_stars_repo_path": "test/timerTest.js", "max_stars_repo_name": "yoo2001818/r6rs-async-io", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/timerTest.js", "max_issues_repo_name": "yoo2001818/r6rs-async-io", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/timerTest.js", "max_forks_repo_name": "yoo2001818/r6rs-async-io", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.32, "max_line_length": 61, "alphanum_fraction": 0.6430921053}
// Simple test of setInterval implementation.
import IOManager from '../src/ioManager';
import { Machine, assert } from 'r6rs';

let machine = new Machine();
let ioManager = new IOManager(machine);
ioManager.resolver.add('setInterval', (params, callback) => {
  assert(params, 'number');
  let timerId = setInterval(callback, params.value);
  return () => {
    clearInterval(timerId);
  };
});
machine.loadLibrary(ioManager.getLibrary());

machine.evaluate(`
(let ((x 0) (y 0))
  (set! y (io-on "setInterval" 1000 (lambda ()
    (set! x (+ x 1))
    (display x)
    (if (>= x 10) (io-cancel y))
  )))
)
`);
