@forwardimpact/libutil 0.1.86 → 0.1.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/runtime.js +5 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forwardimpact/libutil",
3
- "version": "0.1.86",
3
+ "version": "0.1.87",
4
4
  "description": "Cross-cutting utilities: retry, hashing, token counting, and project discovery.",
5
5
  "keywords": [
6
6
  "util",
package/src/runtime.js CHANGED
@@ -40,7 +40,8 @@ import { Finder } from "./finder.js";
40
40
  * `exitCode` accessor.
41
41
  * @property {Object} clock
42
42
  * Time surface: `now()`, `sleep(ms)`, `setTimeout(fn, ms)`,
43
- * `clearTimeout(handle)`.
43
+ * `clearTimeout(handle)`, `setInterval(fn, ms)`, `clearInterval(handle)`.
44
+ * The interval handle mirrors the host timer (so callers may `.unref()` it).
44
45
  * @property {Object} subprocess
45
46
  * Subprocess surface: `run(cmd, args, opts) -> Promise<{stdout, stderr,
46
47
  * exitCode}>` (async, buffered), `runSync(cmd, args, opts) -> {stdout,
@@ -134,7 +135,7 @@ function lineIterator(stream) {
134
135
 
135
136
  /**
136
137
  * Build the clock surface backed by real timers.
137
- * @returns {{now: () => number, sleep: (ms: number) => Promise<void>, setTimeout: Function, clearTimeout: Function}}
138
+ * @returns {{now: () => number, sleep: (ms: number) => Promise<void>, setTimeout: Function, clearTimeout: Function, setInterval: Function, clearInterval: Function}}
138
139
  */
139
140
  export function createDefaultClock() {
140
141
  return {
@@ -142,6 +143,8 @@ export function createDefaultClock() {
142
143
  sleep: (ms) => new Promise((r) => setTimeout(r, ms)),
143
144
  setTimeout: (fn, ms) => setTimeout(fn, ms),
144
145
  clearTimeout: (handle) => clearTimeout(handle),
146
+ setInterval: (fn, ms) => setInterval(fn, ms),
147
+ clearInterval: (handle) => clearInterval(handle),
145
148
  };
146
149
  }
147
150