fishpi 0.0.41 → 0.0.42
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/lib/chatroom.d.ts +8 -8
- package/lib/chatroom.js +6 -6
- package/package.json +1 -1
package/lib/chatroom.d.ts
CHANGED
|
@@ -99,10 +99,10 @@ declare class ChatRoom {
|
|
|
99
99
|
* @param close 关闭回调
|
|
100
100
|
* @returns 返回 Open Event
|
|
101
101
|
*/
|
|
102
|
-
reconnect({ timeout, error, close }
|
|
103
|
-
timeout?: number
|
|
104
|
-
error?: (
|
|
105
|
-
close?: (
|
|
102
|
+
reconnect({ timeout, error, close }?: {
|
|
103
|
+
timeout?: number;
|
|
104
|
+
error?: (ev: any) => void;
|
|
105
|
+
close?: (ev: any) => void;
|
|
106
106
|
}): Promise<unknown>;
|
|
107
107
|
/**
|
|
108
108
|
* 移除聊天室消息监听函数
|
|
@@ -118,10 +118,10 @@ declare class ChatRoom {
|
|
|
118
118
|
*/
|
|
119
119
|
addListener(wsCallback: (event: {
|
|
120
120
|
msg: Message;
|
|
121
|
-
}) => void, { timeout, error, close }
|
|
122
|
-
timeout?: number
|
|
123
|
-
error?: (
|
|
124
|
-
close?: (
|
|
121
|
+
}) => void, { timeout, error, close }?: {
|
|
122
|
+
timeout?: number;
|
|
123
|
+
error?: (ev: any) => void;
|
|
124
|
+
close?: (ev: any) => void;
|
|
125
125
|
}): Promise<void>;
|
|
126
126
|
}
|
|
127
127
|
export default ChatRoom;
|
package/lib/chatroom.js
CHANGED
|
@@ -463,10 +463,10 @@ var ChatRoom = /** @class */ (function () {
|
|
|
463
463
|
* @returns 返回 Open Event
|
|
464
464
|
*/
|
|
465
465
|
ChatRoom.prototype.reconnect = function (_a) {
|
|
466
|
-
var _b = _a.timeout, timeout =
|
|
466
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.timeout, timeout = _c === void 0 ? 10 : _c, _d = _b.error, error = _d === void 0 ? function (ev) { } : _d, _e = _b.close, close = _e === void 0 ? function (ev) { } : _e;
|
|
467
467
|
return __awaiter(this, void 0, void 0, function () {
|
|
468
468
|
var _this = this;
|
|
469
|
-
return __generator(this, function (
|
|
469
|
+
return __generator(this, function (_f) {
|
|
470
470
|
return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
471
471
|
var _a, _b, _c, _d;
|
|
472
472
|
var _e;
|
|
@@ -581,10 +581,10 @@ var ChatRoom = /** @class */ (function () {
|
|
|
581
581
|
* @param close 关闭回调
|
|
582
582
|
*/
|
|
583
583
|
ChatRoom.prototype.addListener = function (wsCallback, _a) {
|
|
584
|
-
var _b = _a.timeout, timeout =
|
|
584
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.timeout, timeout = _c === void 0 ? 10 : _c, _d = _b.error, error = _d === void 0 ? function (ev) { } : _d, _e = _b.close, close = _e === void 0 ? function (ev) { } : _e;
|
|
585
585
|
return __awaiter(this, void 0, void 0, function () {
|
|
586
|
-
return __generator(this, function (
|
|
587
|
-
switch (
|
|
586
|
+
return __generator(this, function (_f) {
|
|
587
|
+
switch (_f.label) {
|
|
588
588
|
case 0:
|
|
589
589
|
if (this._rws !== null) {
|
|
590
590
|
if (this._wsCallbacks.indexOf(wsCallback) < 0)
|
|
@@ -594,7 +594,7 @@ var ChatRoom = /** @class */ (function () {
|
|
|
594
594
|
this._wsCallbacks.push(wsCallback);
|
|
595
595
|
return [4 /*yield*/, this.reconnect({ timeout: timeout, error: error, close: close })];
|
|
596
596
|
case 1:
|
|
597
|
-
|
|
597
|
+
_f.sent();
|
|
598
598
|
return [2 /*return*/];
|
|
599
599
|
}
|
|
600
600
|
});
|