@nxtedition/deepstream.io-client-js 32.0.4 → 32.0.6
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/src/record/record.d.ts +4 -3
- package/src/record/record.js +28 -24
package/package.json
CHANGED
package/src/record/record.d.ts
CHANGED
|
@@ -18,9 +18,9 @@ export type GettablePossibleEmpty<Data> = keyof Data extends never
|
|
|
18
18
|
Data
|
|
19
19
|
: SingleKeyObject<Data> extends never
|
|
20
20
|
? // There are more than one property in Data, and some of them are
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
// required. That means that the user must always check for the empty
|
|
22
|
+
// object case.
|
|
23
|
+
Data | EmptyObject
|
|
24
24
|
: // There is exactly one property in Data, and it is required. In this
|
|
25
25
|
// particular case, we can safely use Data as the "empty" type, but
|
|
26
26
|
// with the single property turned optional.
|
|
@@ -45,6 +45,7 @@ export interface UpdateOptions {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export interface ObserveOptions {
|
|
48
|
+
key?: string
|
|
48
49
|
signal?: AbortSignal
|
|
49
50
|
timeout?: number
|
|
50
51
|
state?: number
|
package/src/record/record.js
CHANGED
|
@@ -598,34 +598,38 @@ class Record {
|
|
|
598
598
|
throw new Error('cannot reenter emitUpdate')
|
|
599
599
|
}
|
|
600
600
|
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
601
|
+
if (this._subscriptions != null) {
|
|
602
|
+
try {
|
|
603
|
+
const arr = this._subscriptions
|
|
604
|
+
const len = arr.length
|
|
605
|
+
|
|
606
|
+
this._emittingArr = arr
|
|
607
|
+
for (let n = 0; n < len; n += 2) {
|
|
608
|
+
this._emittingIndex = n
|
|
609
|
+
// TODO (fix): What if this throws?
|
|
610
|
+
arr[n + 0](this, arr[n + 1])
|
|
611
|
+
}
|
|
612
|
+
} finally {
|
|
613
|
+
this._emittingArr = null
|
|
614
|
+
this._emittingIndex = -1
|
|
610
615
|
}
|
|
611
|
-
} finally {
|
|
612
|
-
this._emittingArr = null
|
|
613
|
-
this._emittingIndex = -1
|
|
614
616
|
}
|
|
615
617
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
618
|
+
if (this._observers != null) {
|
|
619
|
+
try {
|
|
620
|
+
const arr = this._observers
|
|
621
|
+
const len = arr.length
|
|
622
|
+
|
|
623
|
+
this._emittingArr = arr
|
|
624
|
+
for (let n = 0; n < len; n++) {
|
|
625
|
+
this._emittingIndex = n
|
|
626
|
+
// TODO (fix): What if this throws?
|
|
627
|
+
arr[n].onUpdate(this, arr[n])
|
|
628
|
+
}
|
|
629
|
+
} finally {
|
|
630
|
+
this._emittingArr = null
|
|
631
|
+
this._emittingIndex = -1
|
|
625
632
|
}
|
|
626
|
-
} finally {
|
|
627
|
-
this._emittingArr = null
|
|
628
|
-
this._emittingIndex = -1
|
|
629
633
|
}
|
|
630
634
|
|
|
631
635
|
this._handler._client.emit('recordUpdated', this)
|