@hyperfrontend/time-utils 0.0.4 → 0.0.5

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 (41) hide show
  1. package/CHANGELOG.md +14 -6
  2. package/README.md +3 -1
  3. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/date/index.cjs.js +10 -0
  4. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/date/index.esm.js +8 -0
  5. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.cjs.js +6 -0
  6. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.esm.js +5 -0
  7. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.cjs.js +5 -0
  8. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.esm.js +4 -0
  9. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/number/index.cjs.js +4 -0
  10. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/number/index.esm.js +5 -0
  11. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.cjs.js +5 -0
  12. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.esm.js +4 -0
  13. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/promise/index.cjs.js +6 -0
  14. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/promise/index.esm.js +5 -0
  15. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/timers/index.cjs.js +18 -0
  16. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/timers/index.esm.js +14 -0
  17. package/bundle/index.iife.js +119 -24
  18. package/bundle/index.iife.min.js +0 -1
  19. package/bundle/index.umd.js +119 -24
  20. package/bundle/index.umd.min.js +0 -1
  21. package/index.cjs.js +84 -213
  22. package/index.d.ts +134 -6
  23. package/index.d.ts.map +1 -1
  24. package/index.esm.js +67 -196
  25. package/package.json +12 -7
  26. package/bundle/index.iife.js.map +0 -1
  27. package/bundle/index.iife.min.js.map +0 -1
  28. package/bundle/index.umd.js.map +0 -1
  29. package/bundle/index.umd.min.js.map +0 -1
  30. package/create-clock.d.ts +0 -20
  31. package/create-clock.d.ts.map +0 -1
  32. package/create-timer.d.ts +0 -18
  33. package/create-timer.d.ts.map +0 -1
  34. package/index.cjs.js.map +0 -1
  35. package/index.esm.js.map +0 -1
  36. package/normalize-to-base-time-window.d.ts +0 -9
  37. package/normalize-to-base-time-window.d.ts.map +0 -1
  38. package/set-interval-callback.d.ts +0 -9
  39. package/set-interval-callback.d.ts.map +0 -1
  40. package/sleep.d.ts +0 -8
  41. package/sleep.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,16 +1,24 @@
1
1
  # Changelog
2
2
 
3
- This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
3
+ All notable changes to this project will be documented in this file.
4
4
 
5
- ## [0.0.4](https://github.com/AndrewRedican/hyperfrontend/compare/lib-time-utils@0.0.3...lib-time-utils@0.0.4) (2026-03-08)
5
+ ## [0.0.5](https://github.com/AndrewRedican/hyperfrontend/compare/c8db08be8b183addd26caf81fdd17fb3693f296f...466c0388c4cd516b9c704214140b4df1004098e6) - 2026-06-23
6
6
 
7
- ## [0.0.3](https://github.com/AndrewRedican/hyperfrontend/compare/lib-time-utils@0.0.2...lib-time-utils@0.0.3) (2026-03-02)
7
+ ### Other
8
8
 
9
+ - **@hyperfrontend/workspace:** remove lib-builder and tool-package as implicit dependencies for all lib projects
10
+
11
+ ## [0.0.4](https://github.com/AndrewRedican/hyperfrontend/compare/lib-time-utils@0.0.3...lib-time-utils@0.0.4) - 2026-03-08
12
+
13
+
14
+ ## [0.0.3](https://github.com/AndrewRedican/hyperfrontend/compare/lib-time-utils@0.0.2...lib-time-utils@0.0.3) - 2026-03-02
9
15
 
10
16
  ### Bug Fixes
11
17
 
12
- * **lib-time-utils:** correct package exports and dependencies ([3b9096b](https://github.com/AndrewRedican/hyperfrontend/commit/3b9096b54337c2c2f3e06d6b97865a772e79aad9))
18
+ - **lib-time-utils:** correct package exports and dependencies ([3b9096b](https://github.com/AndrewRedican/hyperfrontend/commit/3b9096b54337c2c2f3e06d6b97865a772e79aad9))
19
+
20
+ ## [0.0.2](https://github.com/AndrewRedican/hyperfrontend/compare/lib-time-utils@0.0.1...lib-time-utils@0.0.2) - 2026-02-26
21
+
13
22
 
14
- ## [0.0.2](https://github.com/AndrewRedican/hyperfrontend/compare/lib-time-utils@0.0.1...lib-time-utils@0.0.2) (2026-02-26)
23
+ ## 0.0.1 - 2026-02-15
15
24
 
16
- ## 0.0.1 (2026-02-15)
package/README.md CHANGED
@@ -35,6 +35,8 @@
35
35
 
36
36
  Functional time utilities for async operations, intervals, and time normalization.
37
37
 
38
+ • 👉 See [**documentation**](https://www.hyperfrontend.dev/docs/libraries/utils/time/)
39
+
38
40
  ## What is @hyperfrontend/time-utils?
39
41
 
40
42
  `@hyperfrontend/time-utils` provides composable, testable utilities for working with time-based operations in JavaScript. The library focuses on enhancing the control and flexibility of standard timing APIs (`setTimeout`, `setInterval`) while adding specialized utilities for async workflows and time window calculations.
@@ -257,4 +259,4 @@ This library is part of the [hyperfrontend](https://github.com/AndrewRedican/hyp
257
259
 
258
260
  ## License
259
261
 
260
- MIT
262
+ [MIT](https://github.com/AndrewRedican/hyperfrontend/blob/main/LICENSE.md)
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ const _Date = globalThis.Date;
4
+ const _Reflect = globalThis.Reflect;
5
+ function createDate(...args) {
6
+ return _Reflect.construct(_Date, args);
7
+ }
8
+ const dateNow = _Date.now;
9
+ exports.createDate = createDate;
10
+ exports.dateNow = dateNow;
@@ -0,0 +1,8 @@
1
+ const _Date = globalThis.Date;
2
+ const _Reflect = globalThis.Reflect;
3
+ function createDate(...args) {
4
+ return _Reflect.construct(_Date, args);
5
+ }
6
+ const dateNow = _Date.now;
7
+
8
+ export { createDate, dateNow };
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ const _Error = globalThis.Error;
4
+ const _Reflect = globalThis.Reflect;
5
+ const createError = (message, options) => _Reflect.construct(_Error, [message, options]);
6
+ exports.createError = createError;
@@ -0,0 +1,5 @@
1
+ const _Error = globalThis.Error;
2
+ const _Reflect = globalThis.Reflect;
3
+ const createError = (message, options) => _Reflect.construct(_Error, [message, options]);
4
+
5
+ export { createError };
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ const _Math = globalThis.Math;
4
+ const floor = _Math.floor;
5
+ exports.floor = floor;
@@ -0,0 +1,4 @@
1
+ const _Math = globalThis.Math;
2
+ const floor = _Math.floor;
3
+
4
+ export { floor };
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+ const _isNaN = globalThis.isNaN;
3
+ const globalIsNaN = _isNaN;
4
+ exports.globalIsNaN = globalIsNaN;
@@ -0,0 +1,5 @@
1
+
2
+ const _isNaN = globalThis.isNaN;
3
+ const globalIsNaN = _isNaN;
4
+
5
+ export { globalIsNaN };
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ const _Object = globalThis.Object;
4
+ const freeze = _Object.freeze;
5
+ exports.freeze = freeze;
@@ -0,0 +1,4 @@
1
+ const _Object = globalThis.Object;
2
+ const freeze = _Object.freeze;
3
+
4
+ export { freeze };
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ const _Promise = globalThis.Promise;
4
+ const _Reflect = globalThis.Reflect;
5
+ const createPromise = (executor) => _Reflect.construct(_Promise, [executor]);
6
+ exports.createPromise = createPromise;
@@ -0,0 +1,5 @@
1
+ const _Promise = globalThis.Promise;
2
+ const _Reflect = globalThis.Reflect;
3
+ const createPromise = (executor) => _Reflect.construct(_Promise, [executor]);
4
+
5
+ export { createPromise };
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ const _setTimeout = globalThis.setTimeout;
4
+ const _setInterval = globalThis.setInterval;
5
+ const _clearTimeout = globalThis.clearTimeout;
6
+ const _clearInterval = globalThis.clearInterval;
7
+ const setTimeout = (callback, delay, ...args) => _setTimeout(callback, delay, ...args);
8
+ const setInterval = (callback, delay, ...args) => _setInterval(callback, delay, ...args);
9
+ const clearTimeout = (id) => {
10
+ _clearTimeout(id);
11
+ };
12
+ const clearInterval = (id) => {
13
+ _clearInterval(id);
14
+ };
15
+ exports.clearInterval = clearInterval;
16
+ exports.clearTimeout = clearTimeout;
17
+ exports.setInterval = setInterval;
18
+ exports.setTimeout = setTimeout;
@@ -0,0 +1,14 @@
1
+ const _setTimeout = globalThis.setTimeout;
2
+ const _setInterval = globalThis.setInterval;
3
+ const _clearTimeout = globalThis.clearTimeout;
4
+ const _clearInterval = globalThis.clearInterval;
5
+ const setTimeout = (callback, delay, ...args) => _setTimeout(callback, delay, ...args);
6
+ const setInterval = (callback, delay, ...args) => _setInterval(callback, delay, ...args);
7
+ const clearTimeout = (id) => {
8
+ _clearTimeout(id);
9
+ };
10
+ const clearInterval = (id) => {
11
+ _clearInterval(id);
12
+ };
13
+
14
+ export { clearInterval, clearTimeout, setInterval, setTimeout };
@@ -4,22 +4,36 @@ var HyperfrontendTimeUtils = (function (exports) {
4
4
  /**
5
5
  * Safe copies of Date built-in via factory function and static methods.
6
6
  *
7
- * Since constructors cannot be safely captured via Object.assign, this module
8
- * provides a factory function that uses Reflect.construct internally.
9
- *
10
- * These references are captured at module initialization time to protect against
11
- * prototype pollution attacks. Import only what you need for tree-shaking.
12
- *
13
7
  * @module @hyperfrontend/immutable-api-utils/built-in-copy/date
14
8
  */
15
- // Capture references at module initialization time
9
+ /* eslint-disable jsdoc/require-param */
16
10
  const _Date = globalThis.Date;
17
11
  const _Reflect$2 = globalThis.Reflect;
12
+ /**
13
+ * (Safe copy) Creates a new Date using the captured Date constructor.
14
+ * Use this instead of `new Date()`. Accepts all standard Date constructor signatures.
15
+ *
16
+ * @returns A new Date instance.
17
+ *
18
+ * @example Creating Date instances
19
+ * ```typescript
20
+ * const now = createDate()
21
+ * const fromTimestamp = createDate(1704067200000)
22
+ * const fromString = createDate('2024-01-01T00:00:00Z')
23
+ * const fromParts = createDate(2024, 0, 1, 12, 30, 0) // Jan 1, 2024 12:30:00
24
+ * ```
25
+ */
18
26
  function createDate(...args) {
19
27
  return _Reflect$2.construct(_Date, args);
20
28
  }
21
29
  /**
22
30
  * (Safe copy) Returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC.
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * const timestamp = dateNow()
35
+ * // => 1704067200000 (example timestamp)
36
+ * ```
23
37
  */
24
38
  const dateNow = _Date.now;
25
39
 
@@ -31,7 +45,6 @@ var HyperfrontendTimeUtils = (function (exports) {
31
45
  *
32
46
  * @module @hyperfrontend/immutable-api-utils/built-in-copy/object
33
47
  */
34
- // Capture references at module initialization time
35
48
  const _Object = globalThis.Object;
36
49
  /**
37
50
  * (Safe copy) Prevents modification of existing property attributes and values,
@@ -47,7 +60,6 @@ var HyperfrontendTimeUtils = (function (exports) {
47
60
  *
48
61
  * @module @hyperfrontend/immutable-api-utils/built-in-copy/timers
49
62
  */
50
- // Capture references at module initialization time
51
63
  const _setTimeout = globalThis.setTimeout;
52
64
  const _setInterval = globalThis.setInterval;
53
65
  const _clearTimeout = globalThis.clearTimeout;
@@ -59,6 +71,13 @@ var HyperfrontendTimeUtils = (function (exports) {
59
71
  * @param delay - Time in milliseconds before executing.
60
72
  * @param args - Additional arguments to pass to the callback.
61
73
  * @returns A numeric ID for the timer.
74
+ *
75
+ * @example Setting a timeout
76
+ * ```typescript
77
+ * const timerId = setTimeout(() => console.log('Executed'), 1000)
78
+ * // Pass arguments to callback
79
+ * setTimeout((name, count) => console.log(name, count), 500, 'items', 5)
80
+ * ```
62
81
  */
63
82
  const setTimeout = (callback, delay, ...args) => _setTimeout(callback, delay, ...args);
64
83
  /**
@@ -68,12 +87,27 @@ var HyperfrontendTimeUtils = (function (exports) {
68
87
  * @param delay - Time in milliseconds between calls.
69
88
  * @param args - Additional arguments to pass to the callback.
70
89
  * @returns A numeric ID for the interval.
90
+ *
91
+ * @example Setting an interval
92
+ * ```typescript
93
+ * let count = 0
94
+ * const intervalId = setInterval(() => {
95
+ * count++
96
+ * if (count >= 5) clearInterval(intervalId)
97
+ * }, 1000)
98
+ * ```
71
99
  */
72
100
  const setInterval = (callback, delay, ...args) => _setInterval(callback, delay, ...args);
73
101
  /**
74
102
  * (Safe copy) Cancels a timeout previously established by setTimeout.
75
103
  *
76
104
  * @param id - The identifier of the timeout to cancel.
105
+ *
106
+ * @example Canceling a timeout
107
+ * ```typescript
108
+ * const timerId = setTimeout(() => console.log('Never runs'), 5000)
109
+ * clearTimeout(timerId)
110
+ * ```
77
111
  */
78
112
  const clearTimeout = (id) => {
79
113
  _clearTimeout(id);
@@ -82,6 +116,13 @@ var HyperfrontendTimeUtils = (function (exports) {
82
116
  * (Safe copy) Cancels a timed, repeating action previously established by setInterval.
83
117
  *
84
118
  * @param id - The identifier of the interval to cancel.
119
+ *
120
+ * @example Canceling an interval
121
+ * ```typescript
122
+ * const intervalId = setInterval(() => console.log('tick'), 1000)
123
+ * // Stop after some condition
124
+ * clearInterval(intervalId)
125
+ * ```
85
126
  */
86
127
  const clearInterval = (id) => {
87
128
  _clearInterval(id);
@@ -96,6 +137,21 @@ var HyperfrontendTimeUtils = (function (exports) {
96
137
  *
97
138
  * @param interval - Time in milliseconds between each callback invocation (default: 1000ms)
98
139
  * @returns A Clock instance with start, stop, subscribe, and unsubscribe methods
140
+ *
141
+ * @example Creating interval clock
142
+ * ```typescript
143
+ * const clock = createClock(1000)
144
+ *
145
+ * const updateDisplay = (currentTime: Date) => {
146
+ * console.log(currentTime.toISOString())
147
+ * }
148
+ *
149
+ * clock.subscribe(updateDisplay)
150
+ * clock.start()
151
+ *
152
+ * // Later: stop receiving updates
153
+ * clock.stop()
154
+ * ```
99
155
  */
100
156
  function createClock(interval = 1000) {
101
157
  let clockId = null;
@@ -130,6 +186,24 @@ var HyperfrontendTimeUtils = (function (exports) {
130
186
  * @param callback - The function to invoke after the delay
131
187
  * @param delay - Time in milliseconds to wait until callback is invoked
132
188
  * @returns A Timer instance with pause, resume, and reset methods
189
+ *
190
+ * @example Creating pausable timer
191
+ * ```typescript
192
+ * const timer = createTimer(() => {
193
+ * console.log('Session expired')
194
+ * }, 30_000)
195
+ *
196
+ * timer.resume() // Start the 30-second countdown
197
+ *
198
+ * // User activity detected - pause the timer
199
+ * timer.pause()
200
+ *
201
+ * // User idle again - resume from where we left off
202
+ * timer.resume()
203
+ *
204
+ * // Reset to full 30 seconds on explicit action
205
+ * timer.reset()
206
+ * ```
133
207
  */
134
208
  function createTimer(callback, delay) {
135
209
  let timerId = null;
@@ -174,7 +248,6 @@ var HyperfrontendTimeUtils = (function (exports) {
174
248
  *
175
249
  * @module @hyperfrontend/immutable-api-utils/built-in-copy/error
176
250
  */
177
- // Capture references at module initialization time
178
251
  const _Error = globalThis.Error;
179
252
  const _Reflect$1 = globalThis.Reflect;
180
253
  /**
@@ -184,6 +257,13 @@ var HyperfrontendTimeUtils = (function (exports) {
184
257
  * @param message - Optional error message.
185
258
  * @param options - Optional error options.
186
259
  * @returns A new Error instance.
260
+ *
261
+ * @example Creating Error instances
262
+ * ```typescript
263
+ * const error = createError('Operation failed')
264
+ * // With cause for error chaining
265
+ * const wrapped = createError('Request failed', { cause: originalError })
266
+ * ```
187
267
  */
188
268
  const createError = (message, options) => _Reflect$1.construct(_Error, [message, options]);
189
269
 
@@ -195,7 +275,6 @@ var HyperfrontendTimeUtils = (function (exports) {
195
275
  *
196
276
  * @module @hyperfrontend/immutable-api-utils/built-in-copy/math
197
277
  */
198
- // Capture references at module initialization time
199
278
  const _Math = globalThis.Math;
200
279
  /**
201
280
  * (Safe copy) Returns the largest integer less than or equal to a number.
@@ -210,11 +289,7 @@ var HyperfrontendTimeUtils = (function (exports) {
210
289
  *
211
290
  * @module @hyperfrontend/immutable-api-utils/built-in-copy/number
212
291
  */
213
- // Capture references at module initialization time
214
292
  const _isNaN = globalThis.isNaN;
215
- // ============================================================================
216
- // Global Type Checking (legacy, less strict)
217
- // ============================================================================
218
293
  /**
219
294
  * (Safe copy) Global isNaN function (coerces to number first, less strict than Number.isNaN).
220
295
  */
@@ -226,6 +301,14 @@ var HyperfrontendTimeUtils = (function (exports) {
226
301
  * @param time - The Date object to normalize to the nearest time window
227
302
  * @param baseTimeWindow - The size of the time window in minutes for normalization
228
303
  * @returns A new Date object normalized to the start of the time window
304
+ *
305
+ * @example Normalizing to 15-minute buckets
306
+ * ```typescript
307
+ * // Round timestamps to 15-minute intervals for analytics bucketing
308
+ * const eventTime = new Date('2024-03-15T14:23:45Z')
309
+ * const bucketTime = normalizeToBaseTimeWindow(eventTime, 15)
310
+ * // => 2024-03-15T14:15:00.000Z
311
+ * ```
229
312
  */
230
313
  function normalizeToBaseTimeWindow(time, baseTimeWindow) {
231
314
  if (!time || !(time instanceof Date) || globalIsNaN(time.getTime())) {
@@ -246,6 +329,16 @@ var HyperfrontendTimeUtils = (function (exports) {
246
329
  * @param callback - The function to invoke at each interval
247
330
  * @param interval - Time in milliseconds between each callback invocation
248
331
  * @returns A cleanup function that stops the interval when called
332
+ *
333
+ * @example Setting interval with cleanup
334
+ * ```typescript
335
+ * const stopPolling = setIntervalCallback(() => {
336
+ * fetchLatestData()
337
+ * }, 5000)
338
+ *
339
+ * // Later: clean up when component unmounts
340
+ * stopPolling()
341
+ * ```
249
342
  */
250
343
  function setIntervalCallback(callback, interval) {
251
344
  const timerId = setInterval(callback, interval);
@@ -253,17 +346,11 @@ var HyperfrontendTimeUtils = (function (exports) {
253
346
  }
254
347
 
255
348
  /**
256
- * Safe copies of Promise built-in methods via factory functions.
257
- *
258
- * Since constructors cannot be safely captured via Object.assign, this module
259
- * provides factory functions that use Reflect.construct internally.
260
- *
261
- * These references are captured at module initialization time to protect against
262
- * prototype pollution attacks. Import only what you need for tree-shaking.
349
+ * Safe Promise factory and bound static methods.
263
350
  *
264
351
  * @module @hyperfrontend/immutable-api-utils/built-in-copy/promise
265
352
  */
266
- // Capture references at module initialization time
353
+ /* eslint-disable workspace/lib-require-jsdoc-example */
267
354
  const _Promise = globalThis.Promise;
268
355
  const _Reflect = globalThis.Reflect;
269
356
  /**
@@ -310,6 +397,15 @@ var HyperfrontendTimeUtils = (function (exports) {
310
397
  *
311
398
  * @param milliseconds - The duration to sleep in milliseconds
312
399
  * @returns A promise that resolves after the specified duration
400
+ *
401
+ * @example Implementing retry backoff
402
+ * ```typescript
403
+ * async function retryWithBackoff(attempt: number) {
404
+ * const backoffMs = Math.min(1000 * 2 ** attempt, 30_000)
405
+ * await sleep(backoffMs)
406
+ * return fetchResource()
407
+ * }
408
+ * ```
313
409
  */
314
410
  function sleep(milliseconds) {
315
411
  return createPromise((resolve) => setTimeout(resolve, milliseconds));
@@ -324,4 +420,3 @@ var HyperfrontendTimeUtils = (function (exports) {
324
420
  return exports;
325
421
 
326
422
  })({});
327
- //# sourceMappingURL=index.iife.js.map
@@ -1,2 +1 @@
1
1
  var HyperfrontendTimeUtils=function(e){"use strict";const l=globalThis.Date,t=globalThis.Reflect;function n(...e){return t.construct(l,e)}const i=l.now,o=globalThis.Object.freeze,s=globalThis.setTimeout,r=globalThis.setInterval,a=globalThis.clearTimeout,c=globalThis.clearInterval,u=(e,l,...t)=>s(e,l,...t),b=(e,l,...t)=>r(e,l,...t),T=e=>{c(e)};const f=globalThis.Error,h=globalThis.Reflect,g=(e,l)=>h.construct(f,[e,l]),m=globalThis.Math.floor,d=globalThis.isNaN;const v=globalThis.Promise,p=globalThis.Reflect;return v.resolve.bind(v),v.reject.bind(v),v.all.bind(v),v.race.bind(v),v.allSettled.bind(v),v.any.bind(v),v.withResolvers?.bind(v),e.createClock=function(e=1e3){let l=null,t=[];return o({start:()=>{null===l&&(l=b(()=>{const e=n();t.forEach(l=>l(e))},e))},stop:()=>{null!==l&&(T(l),l=null)},subscribe:e=>{t.push(e)},unsubscribe:e=>{t=t.filter(l=>l!==e)},interval:e})},e.createTimer=function(e,l){let t=null,n=null,s=l;const r=()=>{if(null!==t){a(t);const e=i();null!==n&&(s-=e-n),t=null}},c=()=>{null===t&&(n=i(),t=u(()=>{e(),t=null},s))};return o({pause:r,resume:c,reset:(e=l)=>{r(),s=e,c()}})},e.normalizeToBaseTimeWindow=function(e,l){if(!e||!(e instanceof Date)||d(e.getTime()))throw g("Invalid time input");if(l<=0)throw g("Base time window must be positive");const t=e.getTime(),i=60*l*1e3;return n(m(t/i)*i)},e.setIntervalCallback=function(e,l){const t=b(e,l);return()=>T(t)},e.sleep=function(e){return l=l=>u(l,e),p.construct(v,[l]);var l},e}({});
2
- //# sourceMappingURL=index.iife.min.js.map