@nxtedition/lib 23.15.4 → 23.15.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "23.15.4",
3
+ "version": "23.15.5",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",
@@ -7,6 +7,7 @@ import fp from 'lodash/fp.js'
7
7
  import moment from 'moment-timezone'
8
8
  import Timecode from 'smpte-timecode'
9
9
  import transform from './transform.js'
10
+ import { doYield } from '../../yield.js'
10
11
 
11
12
  const SEP = String.fromCharCode(30) // ASCII 1E
12
13
 
@@ -223,7 +224,7 @@ function makeWrapper(expression) {
223
224
  }
224
225
 
225
226
  export default function ({ ds, proxify, compiler, logger, platform }) {
226
- const schedule = platform?.schedule ?? ((fn) => queueMicrotask(fn))
227
+ const schedule = platform?.schedule ?? doYield
227
228
 
228
229
  class Expression {
229
230
  constructor(script, expression, args, observer) {
@@ -266,7 +267,7 @@ export default function ({ ds, proxify, compiler, logger, platform }) {
266
267
  })
267
268
  } else {
268
269
  this._args = proxify ? this.wrap(args) : args
269
- this._refreshImpl()
270
+ this._refresh()
270
271
  }
271
272
  }
272
273
 
package/yield.js CHANGED
@@ -2,6 +2,7 @@ import { FixedQueue } from './fixed-queue.js'
2
2
 
3
3
  const yieldTimeout = 50
4
4
  const yieldQueue = new FixedQueue()
5
+ const yieldSchedule = globalThis.setImmediate ?? ((fn) => setTimeout(fn, 0))
5
6
  let yieldScheduled = false
6
7
  let yieldTime = performance.now()
7
8
  let yieldActive = false
@@ -17,7 +18,7 @@ export function maybeYield(opts, callback) {
17
18
  export function doYield(opts, callback) {
18
19
  if (!yieldScheduled) {
19
20
  yieldScheduled = true
20
- setImmediate(dispatchYield)
21
+ yieldSchedule(dispatchYield)
21
22
  }
22
23
 
23
24
  if (callback) {
@@ -44,7 +45,7 @@ function dispatchYield() {
44
45
  resolve(null)
45
46
 
46
47
  if (performance.now() - yieldTime > yieldTimeout) {
47
- setImmediate(dispatchYield)
48
+ yieldSchedule(dispatchYield)
48
49
  return
49
50
  }
50
51
  }