Enhance callback handling in SocketUser class to ensure callback is a function before invocation, preventing potential runtime errors.
This commit is contained in:
parent
0748256ce8
commit
7002e5a6c1
@ -174,16 +174,20 @@ export class SocketUser {
|
|||||||
data.objectType,
|
data.objectType,
|
||||||
data.filter
|
data.filter
|
||||||
);
|
);
|
||||||
|
if (typeof callback === 'function') {
|
||||||
callback({ success: true });
|
callback({ success: true });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async handleSubscribeToObjectUpdateEvent(data, callback) {
|
async handleSubscribeToObjectUpdateEvent(data, callback) {
|
||||||
const result = await this.updateManager.subscribeToObjectUpdate(
|
const result = await this.updateManager.subscribeToObjectUpdate(
|
||||||
data._id,
|
data._id,
|
||||||
data.objectType
|
data.objectType
|
||||||
);
|
);
|
||||||
|
if (typeof callback === 'function') {
|
||||||
callback(result);
|
callback(result);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async handleSubscribeToObjectEventEvent(data) {
|
async handleSubscribeToObjectEventEvent(data) {
|
||||||
await this.eventManager.subscribeToObjectEvent(
|
await this.eventManager.subscribeToObjectEvent(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user