@oscarpalmer/atoms 0.166.1 → 0.166.2

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.
package/dist/index.mjs CHANGED
@@ -1127,7 +1127,7 @@ function getTimer(type, callback, time) {
1127
1127
  function run(now) {
1128
1128
  start ??= now;
1129
1129
  if (interval === 0 || now - start >= interval - OFFSET) {
1130
- if (throttle) start = now;
1130
+ start = throttle ? now : void 0;
1131
1131
  callback(...args);
1132
1132
  } else frame = requestAnimationFrame(run);
1133
1133
  }
@@ -7,7 +7,7 @@ function getTimer(type, callback, time) {
7
7
  function run(now) {
8
8
  start ??= now;
9
9
  if (interval === 0 || now - start >= interval - OFFSET) {
10
- if (throttle) start = now;
10
+ start = throttle ? now : void 0;
11
11
  callback(...args);
12
12
  } else frame = requestAnimationFrame(run);
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oscarpalmer/atoms",
3
- "version": "0.166.1",
3
+ "version": "0.166.2",
4
4
  "description": "Atomic utilities for making your JavaScript better.",
5
5
  "keywords": [
6
6
  "helper",
@@ -23,9 +23,7 @@ export function getTimer<Callback extends GenericCallback>(
23
23
  start ??= now;
24
24
 
25
25
  if (interval === 0 || now - start >= interval - OFFSET) {
26
- if (throttle) {
27
- start = now;
28
- }
26
+ start = throttle ? now : undefined;
29
27
 
30
28
  callback(...args);
31
29
  } else {
@@ -37,7 +35,7 @@ export function getTimer<Callback extends GenericCallback>(
37
35
 
38
36
  let args: Parameters<Callback>;
39
37
  let frame: DOMHighResTimeStamp | undefined;
40
- let start: DOMHighResTimeStamp;
38
+ let start: DOMHighResTimeStamp | undefined;
41
39
 
42
40
  const timer = (...parameters: Parameters<Callback>): void => {
43
41
  timer.cancel();