@nxtedition/lib 23.16.2 → 23.16.4
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/package.json +1 -1
- package/yield.js +16 -7
package/package.json
CHANGED
package/yield.js
CHANGED
|
@@ -28,25 +28,34 @@ export function maybeYield(callback) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
if (shouldYield()) {
|
|
31
|
-
doYield(callback)
|
|
32
|
-
}
|
|
31
|
+
return doYield(callback)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (callback != null) {
|
|
33
35
|
callback(null)
|
|
34
36
|
}
|
|
37
|
+
|
|
38
|
+
return null
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
export function doYield(callback) {
|
|
42
|
+
if (callback != null && typeof callback !== 'function') {
|
|
43
|
+
throw new TypeError('callback must be a function')
|
|
44
|
+
}
|
|
45
|
+
|
|
38
46
|
if (!yieldScheduled) {
|
|
39
47
|
yieldScheduled = true
|
|
40
48
|
yieldSchedule(dispatchYield)
|
|
41
49
|
}
|
|
42
50
|
|
|
43
|
-
if (callback) {
|
|
51
|
+
if (callback != null) {
|
|
44
52
|
yieldQueue.push(callback)
|
|
45
|
-
|
|
46
|
-
return new Promise((resolve) => {
|
|
47
|
-
yieldQueue.push(resolve)
|
|
48
|
-
})
|
|
53
|
+
return null
|
|
49
54
|
}
|
|
55
|
+
|
|
56
|
+
return new Promise((resolve) => {
|
|
57
|
+
yieldQueue.push(resolve)
|
|
58
|
+
})
|
|
50
59
|
}
|
|
51
60
|
|
|
52
61
|
function dispatchYield() {
|