@nxtedition/deepstream.io-client-js 24.1.22 → 24.2.1
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
|
@@ -140,10 +140,10 @@ Connection.prototype.send = function (message) {
|
|
|
140
140
|
if (this._endpoint._socket && !this._corked) {
|
|
141
141
|
this._endpoint._socket.cork()
|
|
142
142
|
this._corked = true
|
|
143
|
-
|
|
143
|
+
setTimeout(() => {
|
|
144
144
|
this._endpoint._socket.uncork()
|
|
145
145
|
this._corked = false
|
|
146
|
-
})
|
|
146
|
+
}, 1)
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
this.emit('send', message)
|
|
@@ -188,7 +188,7 @@ Connection.prototype._onOpen = function () {
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
Connection.prototype._onError = function (err) {
|
|
191
|
-
this._recvMessages()
|
|
191
|
+
this._recvMessages({ didTimeout: true, timeRemaining: () => 0 })
|
|
192
192
|
|
|
193
193
|
if (err.error) {
|
|
194
194
|
const { message, error } = err
|
|
@@ -210,7 +210,7 @@ Connection.prototype._onError = function (err) {
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
Connection.prototype._onClose = function () {
|
|
213
|
-
this._recvMessages()
|
|
213
|
+
this._recvMessages({ didTimeout: true, timeRemaining: () => 0 })
|
|
214
214
|
|
|
215
215
|
if (this._deliberateClose === true) {
|
|
216
216
|
this._setState(C.CONNECTION_STATE.CLOSED)
|
|
@@ -236,7 +236,7 @@ Connection.prototype._recvMessages = function (deadline) {
|
|
|
236
236
|
for (
|
|
237
237
|
let n = 0;
|
|
238
238
|
// eslint-disable-next-line no-unmodified-loop-condition
|
|
239
|
-
|
|
239
|
+
deadline ? deadline.didTimeout || deadline.timeRemaining() : n < this._batchSize;
|
|
240
240
|
++n
|
|
241
241
|
) {
|
|
242
242
|
const message = this._recvQueue.shift()
|
|
@@ -356,7 +356,7 @@ class RecordHandler {
|
|
|
356
356
|
return
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
|
|
359
|
+
setTimeout(() => {
|
|
360
360
|
// Token must be universally unique until deepstream properly separates
|
|
361
361
|
// sync requests from different sockets.
|
|
362
362
|
const token = xuid()
|
|
@@ -367,7 +367,7 @@ class RecordHandler {
|
|
|
367
367
|
}
|
|
368
368
|
})
|
|
369
369
|
this._connection.sendMsg2(C.TOPIC.RECORD, C.ACTIONS.SYNC, token, 'WEAK')
|
|
370
|
-
})
|
|
370
|
+
}, 1)
|
|
371
371
|
}
|
|
372
372
|
|
|
373
373
|
set(name, ...args) {
|
|
@@ -504,7 +504,10 @@ class RecordHandler {
|
|
|
504
504
|
|
|
505
505
|
if (
|
|
506
506
|
idx < args.length &&
|
|
507
|
-
(args[idx] == null ||
|
|
507
|
+
(args[idx] == null ||
|
|
508
|
+
typeof args[idx] === 'string' ||
|
|
509
|
+
Array.isArray(args[idx]) ||
|
|
510
|
+
typeof args[idx] === 'function')
|
|
508
511
|
) {
|
|
509
512
|
path = args[idx++]
|
|
510
513
|
}
|
package/src/record/record.js
CHANGED
|
@@ -125,7 +125,15 @@ class Record {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
get(path) {
|
|
128
|
-
|
|
128
|
+
if (!path) {
|
|
129
|
+
return this._data
|
|
130
|
+
} else if (typeof path === 'string' || Array.isArray(path)) {
|
|
131
|
+
return jsonPath.get(this._data, path)
|
|
132
|
+
} else if (typeof path === 'function') {
|
|
133
|
+
return path(this._data)
|
|
134
|
+
} else {
|
|
135
|
+
throw new Error('invalid argument: path')
|
|
136
|
+
}
|
|
129
137
|
}
|
|
130
138
|
|
|
131
139
|
set(pathOrData, dataOrNil) {
|
package/src/utils/utils.js
CHANGED
|
@@ -126,7 +126,11 @@ module.exports.AbortError = class AbortError extends Error {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
function defaultSchedule(fn) {
|
|
130
|
+
setTimeout(fn, 0)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
module.exports.schedule = isNode ? defaultSchedule : window.requestIdleCallback
|
|
130
134
|
|
|
131
135
|
const abortSignals = new WeakMap()
|
|
132
136
|
const onAbort = function () {
|