vrpc 3.8.2 → 3.8.3
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/vrpc/VrpcAdapter.js +11 -0
- package/vrpc/VrpcClient.js +11 -0
package/package.json
CHANGED
package/vrpc/VrpcAdapter.js
CHANGED
|
@@ -547,6 +547,17 @@ class VrpcAdapter {
|
|
|
547
547
|
return
|
|
548
548
|
}
|
|
549
549
|
const unwrapped = VrpcAdapter._unwrapArguments(json)
|
|
550
|
+
// special case: removing a listener the adapter does not hold (the
|
|
551
|
+
// client's subscription outlived a restart of this agent, or it sent
|
|
552
|
+
// no listener at all) - nothing to remove, and the instance's
|
|
553
|
+
// EventEmitter would throw on a listener that is not a function
|
|
554
|
+
if (
|
|
555
|
+
(json.f === 'off' || json.f === 'removeListener') &&
|
|
556
|
+
typeof unwrapped[1] !== 'function'
|
|
557
|
+
) {
|
|
558
|
+
json.r = true
|
|
559
|
+
return
|
|
560
|
+
}
|
|
550
561
|
// Check whether context is a registered class
|
|
551
562
|
const entry = VrpcAdapter._functionRegistry.get(json.c)
|
|
552
563
|
if (entry !== undefined) {
|
package/vrpc/VrpcClient.js
CHANGED
|
@@ -1284,6 +1284,17 @@ class VrpcClient extends EventEmitter {
|
|
|
1284
1284
|
isContinuousRemover
|
|
1285
1285
|
) {
|
|
1286
1286
|
const id = await this._offRemoteEvent({ callback })
|
|
1287
|
+
if (
|
|
1288
|
+
!id &&
|
|
1289
|
+
(functionName === 'off' || functionName === 'removeListener')
|
|
1290
|
+
) {
|
|
1291
|
+
// Nothing of ours to remove - the subscription was already
|
|
1292
|
+
// dropped (the instance or its agent went away and the cache
|
|
1293
|
+
// was cleared, or the listener was never registered). Sending
|
|
1294
|
+
// the call anyway would hand the agent a null listener, which
|
|
1295
|
+
// its EventEmitter rejects. Handled locally: nothing to do.
|
|
1296
|
+
return null
|
|
1297
|
+
}
|
|
1287
1298
|
wrapped.push(id || null)
|
|
1288
1299
|
continue
|
|
1289
1300
|
} else {
|