@nxtedition/lib 22.1.4 → 22.2.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/couch.d.ts +1 -0
- package/errors.d.ts +3 -1
- package/package.json +2 -1
- package/scheduler.js +32 -0
- package/util/template/javascript.js +1 -6
package/couch.d.ts
CHANGED
package/errors.d.ts
CHANGED
|
@@ -17,7 +17,9 @@ export interface NxtError {
|
|
|
17
17
|
errors?: NxtError[] | null
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
type SerializableError = null | undefined | Error | string | NxtError | SerializableError[]
|
|
21
|
+
|
|
22
|
+
export function serializeError(err: SerializableError): NxtError[] | null
|
|
21
23
|
|
|
22
24
|
export type Message = {
|
|
23
25
|
msg: string
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/lib",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Robert Nagy <robert.nagy@boffins.se>",
|
|
6
6
|
"type": "module",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"errors.js",
|
|
37
37
|
"errors.d.ts",
|
|
38
38
|
"worker.js",
|
|
39
|
+
"scheduler.js",
|
|
39
40
|
"stream.js",
|
|
40
41
|
"timeline.js",
|
|
41
42
|
"docker-secrets.js"
|
package/scheduler.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { setImmediate } from 'timers/promises'
|
|
2
|
+
|
|
3
|
+
let yieldTime = performance.now()
|
|
4
|
+
let yieldPromise = undefined
|
|
5
|
+
|
|
6
|
+
function reset() {
|
|
7
|
+
yieldTime = performance.now()
|
|
8
|
+
yieldPromise = undefined
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
setInterval(reset, 100).unref()
|
|
12
|
+
|
|
13
|
+
export function shouldYield() {
|
|
14
|
+
if (yieldPromise === undefined) {
|
|
15
|
+
yieldPromise = performance.now() - yieldTime > 50 ? null : undefined
|
|
16
|
+
}
|
|
17
|
+
return yieldPromise !== undefined
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function maybeYield() {
|
|
21
|
+
if (yieldPromise === undefined) {
|
|
22
|
+
yieldPromise = performance.now() - yieldTime > 50 ? null : undefined
|
|
23
|
+
}
|
|
24
|
+
if (yieldPromise === null) {
|
|
25
|
+
yieldPromise = setImmediate().then(reset)
|
|
26
|
+
}
|
|
27
|
+
return yieldPromise ?? null
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export async function yield() {
|
|
31
|
+
return (yieldPromise ??= setImmediate().then(reset))
|
|
32
|
+
}
|
|
@@ -233,7 +233,6 @@ export default function ({ ds, proxify, compiler }) {
|
|
|
233
233
|
this._wrap = null
|
|
234
234
|
this._suspended = false
|
|
235
235
|
this._errored = false
|
|
236
|
-
this._refreshImpl = this._refreshImpl.bind(this)
|
|
237
236
|
|
|
238
237
|
if (rxjs.isObservable(args)) {
|
|
239
238
|
this._subscription = args.subscribe({
|
|
@@ -243,10 +242,6 @@ export default function ({ ds, proxify, compiler }) {
|
|
|
243
242
|
},
|
|
244
243
|
error: (err) => {
|
|
245
244
|
this._observer.error(err)
|
|
246
|
-
this._subscription = null
|
|
247
|
-
},
|
|
248
|
-
complete: () => {
|
|
249
|
-
this._subscription = null
|
|
250
245
|
},
|
|
251
246
|
})
|
|
252
247
|
} else {
|
|
@@ -338,7 +333,7 @@ export default function ({ ds, proxify, compiler }) {
|
|
|
338
333
|
this._entries.clear()
|
|
339
334
|
}
|
|
340
335
|
|
|
341
|
-
_refreshImpl() {
|
|
336
|
+
_refreshImpl = () => {
|
|
342
337
|
this._refreshing = false
|
|
343
338
|
|
|
344
339
|
if (this._destroyed || this._disposing || this._args === kEmpty) {
|