解决 subscriber emit sub回调未进入
This commit is contained in:
parent
5cba70b566
commit
a88490f9d1
|
|
@ -183,19 +183,22 @@ export class SubScriber extends Feature {
|
|||
}
|
||||
else if (this.socketState === 'connected' && newEvents.length > 0) {
|
||||
await new Promise((resolve, reject) => {
|
||||
this.socket.emit('sub', newEvents, (result) => {
|
||||
if (result) {
|
||||
this.message.setMessage({
|
||||
type: 'error',
|
||||
title: 'sub data error',
|
||||
content: result,
|
||||
});
|
||||
reject();
|
||||
}
|
||||
else {
|
||||
resolve(undefined);
|
||||
}
|
||||
});
|
||||
// this.socket.emit('sub', newEvents, (result) => {
|
||||
// if (result) {
|
||||
// this.message.setMessage({
|
||||
// type: 'error',
|
||||
// title: 'sub data error',
|
||||
// content: result,
|
||||
// });
|
||||
// reject();
|
||||
// }
|
||||
// else {
|
||||
// resolve(undefined);
|
||||
// }
|
||||
// });
|
||||
// TODO 临时代码 后续结合文档再解决
|
||||
this.socket.emit('sub', newEvents);
|
||||
resolve(undefined);
|
||||
});
|
||||
}
|
||||
return () => {
|
||||
|
|
|
|||
|
|
@ -187,19 +187,21 @@ class SubScriber extends Feature_1.Feature {
|
|||
}
|
||||
else if (this.socketState === 'connected' && newEvents.length > 0) {
|
||||
await new Promise((resolve, reject) => {
|
||||
this.socket.emit('sub', newEvents, (result) => {
|
||||
if (result) {
|
||||
this.message.setMessage({
|
||||
type: 'error',
|
||||
title: 'sub data error',
|
||||
content: result,
|
||||
});
|
||||
reject();
|
||||
}
|
||||
else {
|
||||
resolve(undefined);
|
||||
}
|
||||
});
|
||||
// this.socket.emit('sub', newEvents, (result) => {
|
||||
// if (result) {
|
||||
// this.message.setMessage({
|
||||
// type: 'error',
|
||||
// title: 'sub data error',
|
||||
// content: result,
|
||||
// });
|
||||
// reject();
|
||||
// }
|
||||
// else {
|
||||
// resolve(undefined);
|
||||
// }
|
||||
// });
|
||||
this.socket.emit('sub', newEvents);
|
||||
resolve(undefined);
|
||||
});
|
||||
}
|
||||
return () => {
|
||||
|
|
|
|||
|
|
@ -226,19 +226,22 @@ export class SubScriber<ED extends EntityDict & BaseEntityDict> extends Feature
|
|||
else if (this.socketState === 'connected' && newEvents.length > 0) {
|
||||
await new Promise(
|
||||
(resolve, reject) => {
|
||||
this.socket!.emit('sub', newEvents, (result: string) => {
|
||||
if (result) {
|
||||
this.message.setMessage({
|
||||
type: 'error',
|
||||
title: 'sub data error',
|
||||
content: result,
|
||||
});
|
||||
reject();
|
||||
}
|
||||
else {
|
||||
resolve(undefined);
|
||||
}
|
||||
});
|
||||
// this.socket!.emit('sub', newEvents, (result: string) => {
|
||||
// if (result) {
|
||||
// this.message.setMessage({
|
||||
// type: 'error',
|
||||
// title: 'sub data error',
|
||||
// content: result,
|
||||
// });
|
||||
// reject();
|
||||
// }
|
||||
// else {
|
||||
// resolve(undefined);
|
||||
// }
|
||||
// });
|
||||
// TODO 临时代码 后续结合文档再解决
|
||||
this.socket!.emit('sub', newEvents);
|
||||
resolve(undefined);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue