@nxtedition/timers 1.0.8 → 1.1.0

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/lib/index.d.ts CHANGED
@@ -7,6 +7,6 @@ declare class Timeout {
7
7
  refresh(): void;
8
8
  clear(): void;
9
9
  }
10
- export declare function setTimeout<T>(callback: (opaque: T) => void, delay: number, opaque: T): Timeout | ReturnType<typeof globalThis.setTimeout>;
11
- export declare function clearTimeout(timeout: Timeout | ReturnType<typeof globalThis.setTimeout> | null | undefined): void;
10
+ export declare function setTimeout<T>(callback: (opaque: T) => void, delay: number, opaque: T): Timeout | NodeJS.Timeout;
11
+ export declare function clearTimeout(timeout: Timeout | NodeJS.Timeout | null | undefined): void;
12
12
  export {};
package/lib/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { doYield, shouldYield } from '@nxtedition/yield'
2
2
 
3
3
  let fastNow = 0
4
- let fastNowTimeout = null
4
+ // eslint-disable-next-line typescript-eslint/no-redundant-type-constituents
5
+ let fastNowTimeout = null
5
6
  let fastIndex = 0
6
7
 
7
8
  const fastTimers = []
@@ -96,15 +97,13 @@ export function setTimeout (
96
97
  callback ,
97
98
  delay ,
98
99
  opaque ,
99
- ) {
100
+ ) {
100
101
  return delay < 1e3
101
102
  ? globalThis.setTimeout(callback, delay, opaque)
102
103
  : new Timeout(callback , delay, opaque)
103
104
  }
104
105
 
105
- export function clearTimeout(
106
- timeout ,
107
- ) {
106
+ export function clearTimeout(timeout ) {
108
107
  if (timeout instanceof Timeout) {
109
108
  timeout.clear()
110
109
  } else if (timeout != null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/timers",
3
- "version": "1.0.8",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -32,5 +32,5 @@
32
32
  "dependencies": {
33
33
  "@nxtedition/yield": "^1.0.15"
34
34
  },
35
- "gitHead": "c9b449408262ca9431467193d624f1a043d669bb"
35
+ "gitHead": "80358629a4abe8d9065ac1d1b92ef378493c2dcb"
36
36
  }