@nxtedition/yield 1.0.11 → 1.0.13
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.js +9 -5
- package/package.json +5 -3
package/lib/index.js
CHANGED
|
@@ -45,15 +45,19 @@ export function maybeYield (
|
|
|
45
45
|
opaque ,
|
|
46
46
|
timeout ,
|
|
47
47
|
) {
|
|
48
|
+
if (
|
|
49
|
+
callbackOrTimeout != null &&
|
|
50
|
+
typeof callbackOrTimeout !== 'function' &&
|
|
51
|
+
typeof callbackOrTimeout !== 'number'
|
|
52
|
+
) {
|
|
53
|
+
throw new TypeError('callback must be a function')
|
|
54
|
+
}
|
|
55
|
+
|
|
48
56
|
const callback = typeof callbackOrTimeout === 'function' ? callbackOrTimeout : undefined
|
|
49
57
|
if (timeout === undefined && typeof callbackOrTimeout === 'number') {
|
|
50
58
|
timeout = callbackOrTimeout
|
|
51
59
|
}
|
|
52
60
|
|
|
53
|
-
if (callback != null && typeof callback !== 'function') {
|
|
54
|
-
throw new TypeError('callback must be a function')
|
|
55
|
-
}
|
|
56
|
-
|
|
57
61
|
if (shouldYield(timeout)) {
|
|
58
62
|
if (callback != null) {
|
|
59
63
|
doYield(callback, opaque)
|
|
@@ -125,7 +129,7 @@ function dispatchYield() {
|
|
|
125
129
|
|
|
126
130
|
if (yieldIndex === yieldQueue.length) {
|
|
127
131
|
yieldScheduled = false
|
|
128
|
-
yieldQueue.
|
|
132
|
+
yieldQueue.length = 0
|
|
129
133
|
yieldIndex = 0
|
|
130
134
|
} else {
|
|
131
135
|
if (yieldIndex > 16 * 1024) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/yield",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -18,14 +18,16 @@
|
|
|
18
18
|
"prepublishOnly": "yarn build",
|
|
19
19
|
"typecheck": "tsc --noEmit",
|
|
20
20
|
"test": "node --test",
|
|
21
|
-
"test:ci": "node --test"
|
|
21
|
+
"test:ci": "node --test",
|
|
22
|
+
"test:types": "tsd"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"@types/node": "^25.2.3",
|
|
25
26
|
"amaroc": "^1.0.1",
|
|
26
27
|
"oxlint-tsgolint": "^0.13.0",
|
|
27
28
|
"rimraf": "^6.1.3",
|
|
29
|
+
"tsd": "^0.33.0",
|
|
28
30
|
"typescript": "^5.9.3"
|
|
29
31
|
},
|
|
30
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "9b8156711c1909480df222a003871e2d9cded24c"
|
|
31
33
|
}
|