@dxos/async 0.8.4-main.c1de068 → 0.8.4-main.fd6878d

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.
@@ -38,9 +38,7 @@ var addEventListener = (target, type, listener, options) => {
38
38
  return () => target.removeEventListener(type, listener, options);
39
39
  };
40
40
  var SubscriptionList = class {
41
- constructor() {
42
- this._cleanups = [];
43
- }
41
+ _cleanups = [];
44
42
  add(cb) {
45
43
  this._cleanups.push(cb);
46
44
  return this;
@@ -51,6 +49,7 @@ var SubscriptionList = class {
51
49
  }
52
50
  };
53
51
  var SubscriptionSet = class {
52
+ _cleanupMap;
54
53
  constructor(keyProjection) {
55
54
  this._cleanupMap = new ComplexMap(keyProjection);
56
55
  }
@@ -191,10 +190,6 @@ import { Context } from "@dxos/context";
191
190
  var __dxlog_file = "/__w/dxos/dxos/packages/common/async/src/events.ts";
192
191
  var DO_NOT_ERROR_ON_ASYNC_CALLBACK = true;
193
192
  var Event = class _Event {
194
- constructor() {
195
- this._listeners = /* @__PURE__ */ new Set();
196
- this._effects = /* @__PURE__ */ new Set();
197
- }
198
193
  /**
199
194
  * Wrap objects that have on/off style event emitters.
200
195
  */
@@ -207,6 +202,8 @@ var Event = class _Event {
207
202
  });
208
203
  return event;
209
204
  }
205
+ _listeners = /* @__PURE__ */ new Set();
206
+ _effects = /* @__PURE__ */ new Set();
210
207
  /**
211
208
  * Emit an event.
212
209
  * In most cases should only be called by the class or entity containing the event.
@@ -450,6 +447,11 @@ var Event = class _Event {
450
447
  }
451
448
  };
452
449
  var EventListener = class {
450
+ ctx;
451
+ once;
452
+ weak;
453
+ callback;
454
+ _clearDispose;
453
455
  constructor(event, listener, ctx, once, weak) {
454
456
  this.ctx = ctx;
455
457
  this.once = once;
@@ -518,11 +520,9 @@ var weakListeners = () => {
518
520
  import "@dxos/util";
519
521
  import { warnAfterTimeout } from "@dxos/debug";
520
522
  var Mutex = class {
521
- constructor() {
522
- this._queue = Promise.resolve();
523
- this._queueLength = 0;
524
- this._tag = null;
525
- }
523
+ _queue = Promise.resolve();
524
+ _queueLength = 0;
525
+ _tag = null;
526
526
  get tag() {
527
527
  return this._tag;
528
528
  }
@@ -568,6 +568,7 @@ var Mutex = class {
568
568
  }
569
569
  };
570
570
  var MutexGuard = class {
571
+ _release;
571
572
  constructor(_release) {
572
573
  this._release = _release;
573
574
  }
@@ -635,6 +636,11 @@ var TriggerState = /* @__PURE__ */ function(TriggerState2) {
635
636
  return TriggerState2;
636
637
  }({});
637
638
  var Trigger = class {
639
+ _options;
640
+ _promise;
641
+ _resolve;
642
+ _reject;
643
+ _state;
638
644
  constructor(_options = {
639
645
  autoReset: false
640
646
  }) {
@@ -748,6 +754,10 @@ var latch = ({ count = 1, timeout: timeout2 } = {}) => {
748
754
 
749
755
  // src/observable.ts
750
756
  var MulticastObservable = class _MulticastObservable extends Observable {
757
+ _value;
758
+ _observers;
759
+ _observable;
760
+ _completed;
751
761
  constructor(subscriber, _value) {
752
762
  super((observer) => this._subscribe(observer)), this._value = _value, this._observers = /* @__PURE__ */ new Set(), this._completed = new Trigger(), this._handlers = {
753
763
  next: (value) => {
@@ -845,18 +855,18 @@ var MulticastObservable = class _MulticastObservable extends Observable {
845
855
  this._observers.delete(observer);
846
856
  };
847
857
  }
858
+ _handlers;
848
859
  };
849
860
  var EMPTY_OBSERVABLE = MulticastObservable.of(null);
850
861
 
851
862
  // src/observable-value.ts
852
863
  import { createSetDispatch } from "@dxos/util";
853
864
  var ObservableProvider = class {
854
- constructor() {
855
- this._handlers = /* @__PURE__ */ new Set();
856
- this._proxy = createSetDispatch({
857
- handlers: this._handlers
858
- });
859
- }
865
+ _handlers = /* @__PURE__ */ new Set();
866
+ _proxy = createSetDispatch({
867
+ handlers: this._handlers
868
+ });
869
+ _value;
860
870
  /**
861
871
  * Proxy used to dispatch callbacks to each subscription.
862
872
  */
@@ -877,6 +887,8 @@ var ObservableProvider = class {
877
887
  }
878
888
  };
879
889
  var CancellableObservableProvider = class extends ObservableProvider {
890
+ _handleCancel;
891
+ _cancelled;
880
892
  constructor(_handleCancel) {
881
893
  super(), this._handleCancel = _handleCancel, this._cancelled = false;
882
894
  }
@@ -988,6 +1000,11 @@ if (enabled) {
988
1000
 
989
1001
  // src/task-scheduling.ts
990
1002
  var DeferredTask = class {
1003
+ _ctx;
1004
+ _callback;
1005
+ _scheduled;
1006
+ _currentTask;
1007
+ _nextTask;
991
1008
  constructor(_ctx, _callback) {
992
1009
  this._ctx = _ctx;
993
1010
  this._callback = _callback;
@@ -1123,11 +1140,15 @@ var __dxlog_file4 = "/__w/dxos/dxos/packages/common/async/src/persistent-lifecyc
1123
1140
  var INIT_RESTART_DELAY = 100;
1124
1141
  var DEFAULT_MAX_RESTART_DELAY = 5e3;
1125
1142
  var PersistentLifecycle = class extends Resource {
1143
+ _start;
1144
+ _stop;
1145
+ _onRestart;
1146
+ _maxRestartDelay;
1147
+ _currentState = void 0;
1148
+ _restartTask = void 0;
1149
+ _restartAfter = 0;
1126
1150
  constructor({ start, stop, onRestart, maxRestartDelay = DEFAULT_MAX_RESTART_DELAY }) {
1127
1151
  super();
1128
- this._currentState = void 0;
1129
- this._restartTask = void 0;
1130
- this._restartAfter = 0;
1131
1152
  this._start = start;
1132
1153
  this._stop = stop;
1133
1154
  this._onRestart = onRestart;
@@ -1334,11 +1355,6 @@ var streamToArray = (stream) => {
1334
1355
  // src/test-stream.ts
1335
1356
  import { Duplex } from "@dxos/node-std/stream";
1336
1357
  var TestStream = class extends Duplex {
1337
- constructor() {
1338
- super(...arguments);
1339
- this._received = Buffer.alloc(0);
1340
- this._onWrite = new Event();
1341
- }
1342
1358
  static async assertConnectivity(stream1, stream2, { timeout: timeout2 = 200 } = {}) {
1343
1359
  stream1.push("ping");
1344
1360
  stream2.push("pong");
@@ -1351,6 +1367,8 @@ var TestStream = class extends Duplex {
1351
1367
  })
1352
1368
  ]);
1353
1369
  }
1370
+ _received = Buffer.alloc(0);
1371
+ _onWrite = new Event();
1354
1372
  _write(chunk, encoding, callback) {
1355
1373
  this._received = Buffer.concat([
1356
1374
  this._received,
@@ -1428,6 +1446,10 @@ var untilError = (cb) => {
1428
1446
 
1429
1447
  // src/timer.ts
1430
1448
  var Timer = class {
1449
+ _callback;
1450
+ _state;
1451
+ _timer;
1452
+ _count;
1431
1453
  constructor(_callback) {
1432
1454
  this._callback = _callback;
1433
1455
  this._state = new Event();
@@ -1477,6 +1499,16 @@ var Timer = class {
1477
1499
  // src/update-scheduler.ts
1478
1500
  var TIME_PERIOD = 1e3;
1479
1501
  var UpdateScheduler = class {
1502
+ _ctx;
1503
+ _callback;
1504
+ _params;
1505
+ /**
1506
+ * Promise that resolves when the callback is done.
1507
+ * Never rejects.
1508
+ */
1509
+ _promise;
1510
+ _scheduled;
1511
+ _lastUpdateTime;
1480
1512
  constructor(_ctx, _callback, _params = {}) {
1481
1513
  this._ctx = _ctx;
1482
1514
  this._callback = _callback;