@zero-library/common 3.0.10 → 3.1.0
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/dist/index.cjs.js +6 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +6 -6
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -2041,13 +2041,13 @@ var WebSocketManager = class _WebSocketManager {
|
|
|
2041
2041
|
if ((!isNumber(this.maxReconnectAttempts) || this.reconnectAttempts < this.maxReconnectAttempts) && this.reconnectIntervalRef === null) {
|
|
2042
2042
|
this.reconnectIntervalRef = setTimeout(() => {
|
|
2043
2043
|
this.reconnectIntervalRef = null;
|
|
2044
|
-
console.log(`\u5C1D\u8BD5\u7B2C ${this.reconnectAttempts + 1} \u6B21\u91CD\u8FDE...`, this.url);
|
|
2044
|
+
console.log(`[${(/* @__PURE__ */ new Date()).toLocaleString()}]`, `\u5C1D\u8BD5\u7B2C ${this.reconnectAttempts + 1} \u6B21\u91CD\u8FDE...`, this.url);
|
|
2045
2045
|
this.reconnectAttempts++;
|
|
2046
2046
|
this.createAndListenWebSocket();
|
|
2047
2047
|
}, this.reconnectInterval);
|
|
2048
2048
|
} else {
|
|
2049
2049
|
if (isNumber(this.maxReconnectAttempts) && this.reconnectAttempts >= this.maxReconnectAttempts) {
|
|
2050
|
-
console.log("\u8FBE\u5230\u6700\u5927\u91CD\u8FDE\u5C1D\u8BD5\u6B21\u6570\uFF0C\u505C\u6B62\u91CD\u8FDE");
|
|
2050
|
+
console.log(`[${(/* @__PURE__ */ new Date()).toLocaleString()}]`, "\u8FBE\u5230\u6700\u5927\u91CD\u8FDE\u5C1D\u8BD5\u6B21\u6570\uFF0C\u505C\u6B62\u91CD\u8FDE");
|
|
2051
2051
|
}
|
|
2052
2052
|
}
|
|
2053
2053
|
}
|
|
@@ -2056,7 +2056,7 @@ var WebSocketManager = class _WebSocketManager {
|
|
|
2056
2056
|
* WebSocket onopen 事件处理
|
|
2057
2057
|
*/
|
|
2058
2058
|
handleOpen = (newSocket) => {
|
|
2059
|
-
console.log("WebSocket \u8FDE\u63A5\u5DF2\u6253\u5F00");
|
|
2059
|
+
console.log(`[${(/* @__PURE__ */ new Date()).toLocaleString()}]`, "WebSocket \u8FDE\u63A5\u5DF2\u6253\u5F00");
|
|
2060
2060
|
this.stopReconnectTimer();
|
|
2061
2061
|
this.setSocketReadyState(newSocket.readyState);
|
|
2062
2062
|
this.resetHeartbeat(newSocket);
|
|
@@ -2074,7 +2074,7 @@ var WebSocketManager = class _WebSocketManager {
|
|
|
2074
2074
|
* WebSocket onclose 事件处理
|
|
2075
2075
|
*/
|
|
2076
2076
|
handleClose = (event) => {
|
|
2077
|
-
console.log("WebSocket \u8FDE\u63A5\u5DF2\u5173\u95ED", event.code, event.reason);
|
|
2077
|
+
console.log(`[${(/* @__PURE__ */ new Date()).toLocaleString()}]`, "WebSocket \u8FDE\u63A5\u5DF2\u5173\u95ED", event.code, event.reason);
|
|
2078
2078
|
this.setSocketReadyState(WebSocket.CLOSED);
|
|
2079
2079
|
this.stopHeartbeat();
|
|
2080
2080
|
this.listeners.forEach((l) => l.onClose?.());
|
|
@@ -2084,7 +2084,7 @@ var WebSocketManager = class _WebSocketManager {
|
|
|
2084
2084
|
* WebSocket onerror 事件处理
|
|
2085
2085
|
*/
|
|
2086
2086
|
handleError = (error) => {
|
|
2087
|
-
console.error("WebSocket \u53D1\u751F\u9519\u8BEF:", error);
|
|
2087
|
+
console.error(`[${(/* @__PURE__ */ new Date()).toLocaleString()}]`, "WebSocket \u53D1\u751F\u9519\u8BEF:", error);
|
|
2088
2088
|
this.setSocketReadyState(null);
|
|
2089
2089
|
this.stopHeartbeat();
|
|
2090
2090
|
this.tryReconnect();
|
|
@@ -2138,7 +2138,7 @@ var WebSocketManager = class _WebSocketManager {
|
|
|
2138
2138
|
this.socket.send(message3);
|
|
2139
2139
|
this.resetHeartbeat(this.socket);
|
|
2140
2140
|
} else {
|
|
2141
|
-
console.warn("WebSocket \u672A\u8FDE\u63A5\uFF0C\u65E0\u6CD5\u53D1\u9001\u6D88\u606F:", message3);
|
|
2141
|
+
console.warn(`[${(/* @__PURE__ */ new Date()).toLocaleString()}]`, "WebSocket \u672A\u8FDE\u63A5\uFF0C\u65E0\u6CD5\u53D1\u9001\u6D88\u606F:", message3);
|
|
2142
2142
|
}
|
|
2143
2143
|
};
|
|
2144
2144
|
/**
|