a2bei4-utils 1.0.0 → 1.0.2
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/LICENSE +21 -21
- package/README.md +2 -2
- package/dist/a2bei4.utils.cjs.js +1051 -250
- package/dist/a2bei4.utils.cjs.js.map +1 -1
- package/dist/a2bei4.utils.cjs.min.js +1 -1
- package/dist/a2bei4.utils.cjs.min.js.map +1 -1
- package/dist/a2bei4.utils.esm.js +1047 -251
- package/dist/a2bei4.utils.esm.js.map +1 -1
- package/dist/a2bei4.utils.esm.min.js +1 -1
- package/dist/a2bei4.utils.esm.min.js.map +1 -1
- package/dist/a2bei4.utils.umd.js +1051 -250
- package/dist/a2bei4.utils.umd.js.map +1 -1
- package/dist/a2bei4.utils.umd.min.js +1 -1
- package/dist/a2bei4.utils.umd.min.js.map +1 -1
- package/dist/arr.cjs +27 -27
- package/dist/arr.cjs.map +1 -1
- package/dist/arr.js +27 -27
- package/dist/arr.js.map +1 -1
- package/dist/audio.cjs +281 -0
- package/dist/audio.cjs.map +1 -0
- package/dist/audio.js +278 -0
- package/dist/audio.js.map +1 -0
- package/dist/common.cjs +6 -6
- package/dist/common.cjs.map +1 -1
- package/dist/common.js +6 -6
- package/dist/common.js.map +1 -1
- package/dist/download.cjs +43 -0
- package/dist/download.cjs.map +1 -1
- package/dist/download.js +43 -1
- package/dist/download.js.map +1 -1
- package/dist/evt.cjs +148 -148
- package/dist/evt.cjs.map +1 -1
- package/dist/evt.js +148 -148
- package/dist/evt.js.map +1 -1
- package/dist/id.cjs +68 -68
- package/dist/id.cjs.map +1 -1
- package/dist/id.js +68 -68
- package/dist/id.js.map +1 -1
- package/dist/timer.cjs +0 -1
- package/dist/timer.cjs.map +1 -1
- package/dist/timer.js +0 -1
- package/dist/timer.js.map +1 -1
- package/dist/tree.cjs +75 -0
- package/dist/tree.cjs.map +1 -1
- package/dist/tree.js +75 -1
- package/dist/tree.js.map +1 -1
- package/dist/webSocket.cjs +409 -0
- package/dist/webSocket.cjs.map +1 -0
- package/dist/webSocket.js +407 -0
- package/dist/webSocket.js.map +1 -0
- package/package.json +12 -1
- package/readme.txt +8 -5
- package/types/audio.d.ts +57 -0
- package/types/download.d.ts +12 -1
- package/types/index.d.ts +208 -2
- package/types/tree.d.ts +17 -1
- package/types/webSocket.d.ts +124 -0
package/types/index.d.ts
CHANGED
|
@@ -29,6 +29,129 @@ declare class IntervalTimer {
|
|
|
29
29
|
isRunning(): boolean;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* @class WebSocketManager - 一个纯粹、强大的 WebSocket 连接管理引擎
|
|
34
|
+
*
|
|
35
|
+
* @features
|
|
36
|
+
* - 智能断线重连 (指数退避算法)
|
|
37
|
+
* - 网络状态监听
|
|
38
|
+
* - 高度可定制的心跳保活机制 (通过注入函数实现)
|
|
39
|
+
* - 页面可见性 API 集成
|
|
40
|
+
* - 消息发送队列
|
|
41
|
+
* - 清晰的生命周期管理
|
|
42
|
+
* - 优雅的资源销毁
|
|
43
|
+
* - 可配置的数据序列化/反序列化
|
|
44
|
+
* - 纯粹的消息传递,不关心消息内容
|
|
45
|
+
*/
|
|
46
|
+
declare class WebSocketManager {
|
|
47
|
+
/**
|
|
48
|
+
* @param {string} url - WebSocket 服务器的地址
|
|
49
|
+
* @param {object} [options={}] - 配置选项
|
|
50
|
+
* @param {number} [options.heartbeatInterval=30000] - 心跳间隔 (毫秒)
|
|
51
|
+
* @param {number} [options.heartbeatTimeout=10000] - 心跳超时时间 (毫秒)
|
|
52
|
+
* @param {number} [options.reconnectBaseInterval=1000] - 重连基础间隔 (毫秒)
|
|
53
|
+
* @param {number} [options.maxReconnectInterval=30000] - 最大重连间隔 (毫秒)
|
|
54
|
+
* @param {number} [options.maxReconnectAttempts=Infinity] - 最大重连次数
|
|
55
|
+
* @param {boolean} [options.autoConnect=true] - 是否在实例化后自动连接
|
|
56
|
+
* @param {boolean} [options.serializeData=false] - 发送数据时是否自动序列化为JSON字符串
|
|
57
|
+
* @param {boolean} [options.deserializeData=false] - 接收数据时是否自动反序列化为JSON对象
|
|
58
|
+
* @param {function|null} [options.getPingMessage=null] - 返回要发送的 ping 消息内容的函数。如果为 null,则不发送心跳。
|
|
59
|
+
* @param {function|null} [options.isPongMessage=null] - 判断接收到的消息是否为 pong 的函数。接收 MessageEvent 对象作为参数,返回布尔值。
|
|
60
|
+
* @param {object} [options.protocols] - WebSocket 协议
|
|
61
|
+
*/
|
|
62
|
+
constructor(url: string, options?: {
|
|
63
|
+
heartbeatInterval?: number | undefined;
|
|
64
|
+
heartbeatTimeout?: number | undefined;
|
|
65
|
+
reconnectBaseInterval?: number | undefined;
|
|
66
|
+
maxReconnectInterval?: number | undefined;
|
|
67
|
+
maxReconnectAttempts?: number | undefined;
|
|
68
|
+
autoConnect?: boolean | undefined;
|
|
69
|
+
serializeData?: boolean | undefined;
|
|
70
|
+
deserializeData?: boolean | undefined;
|
|
71
|
+
getPingMessage?: Function | null | undefined;
|
|
72
|
+
isPongMessage?: Function | null | undefined;
|
|
73
|
+
protocols?: object | undefined;
|
|
74
|
+
});
|
|
75
|
+
url: string;
|
|
76
|
+
options: {
|
|
77
|
+
heartbeatInterval: number;
|
|
78
|
+
heartbeatTimeout: number;
|
|
79
|
+
reconnectBaseInterval: number;
|
|
80
|
+
maxReconnectInterval: number;
|
|
81
|
+
maxReconnectAttempts: number;
|
|
82
|
+
autoConnect: boolean;
|
|
83
|
+
serializeData: boolean;
|
|
84
|
+
deserializeData: boolean;
|
|
85
|
+
getPingMessage: Function | null;
|
|
86
|
+
isPongMessage: Function | null;
|
|
87
|
+
protocols?: object | undefined;
|
|
88
|
+
};
|
|
89
|
+
ws: WebSocket | null;
|
|
90
|
+
readyState: 3;
|
|
91
|
+
reconnectAttempts: number;
|
|
92
|
+
forcedClose: boolean;
|
|
93
|
+
isReconnecting: boolean;
|
|
94
|
+
heartbeatTimer: number | null;
|
|
95
|
+
heartbeatTimeoutTimer: number | null;
|
|
96
|
+
reconnectTimer: number | null;
|
|
97
|
+
messageQueue: any[];
|
|
98
|
+
listeners: Map<any, any>;
|
|
99
|
+
_onOpen(event: any): void;
|
|
100
|
+
/**
|
|
101
|
+
* 纯粹的消息处理方法:处理心跳,然后将数据交给使用者
|
|
102
|
+
* @param {MessageEvent} event
|
|
103
|
+
*/
|
|
104
|
+
_onMessage(event: MessageEvent): void;
|
|
105
|
+
_onClose(event: any): void;
|
|
106
|
+
_onError(event: any): void;
|
|
107
|
+
_handleVisibilityChange(): void;
|
|
108
|
+
_handleOnline(): void;
|
|
109
|
+
_handleOffline(): void;
|
|
110
|
+
/**
|
|
111
|
+
* 连接到 WebSocket 服务器
|
|
112
|
+
*/
|
|
113
|
+
connect(): void;
|
|
114
|
+
/**
|
|
115
|
+
* 发送数据
|
|
116
|
+
* @param {string|object|ArrayBuffer|Blob} data - 要发送的数据
|
|
117
|
+
*/
|
|
118
|
+
send(data: string | object | ArrayBuffer | Blob): void;
|
|
119
|
+
/**
|
|
120
|
+
* 主动关闭连接
|
|
121
|
+
* @param {number} [code=1000] - 关闭代码
|
|
122
|
+
* @param {string} [reason=''] - 关闭原因
|
|
123
|
+
*/
|
|
124
|
+
close(code?: number, reason?: string): void;
|
|
125
|
+
/**
|
|
126
|
+
* 彻底销毁实例,清理所有资源
|
|
127
|
+
*/
|
|
128
|
+
destroy(): void;
|
|
129
|
+
/**
|
|
130
|
+
* 添加事件监听器
|
|
131
|
+
* @param {string} eventName - 事件名 (e.g., 'open', 'message', 'close', 'error', 'reconnect')
|
|
132
|
+
* @param {function} callback - 回调函数
|
|
133
|
+
*/
|
|
134
|
+
on(eventName: string, callback: Function): void;
|
|
135
|
+
/**
|
|
136
|
+
* 移除事件监听器
|
|
137
|
+
* @param {string} eventName - 事件名
|
|
138
|
+
* @param {function} callback - 回调函数
|
|
139
|
+
*/
|
|
140
|
+
off(eventName: string, callback: Function): void;
|
|
141
|
+
_startHeartbeat(): void;
|
|
142
|
+
_stopHeartbeat(): void;
|
|
143
|
+
_setHeartbeatTimeout(): void;
|
|
144
|
+
_clearHeartbeatTimeout(): void;
|
|
145
|
+
_handlePong(): void;
|
|
146
|
+
_scheduleReconnect(): void;
|
|
147
|
+
_clearReconnectTimer(): void;
|
|
148
|
+
_flushMessageQueue(): void;
|
|
149
|
+
_emit(eventName: any, ...args: any[]): void;
|
|
150
|
+
_updateReadyState(newState: any): void;
|
|
151
|
+
_setupEventListeners(): void;
|
|
152
|
+
_removeEventListeners(): void;
|
|
153
|
+
}
|
|
154
|
+
|
|
32
155
|
/**
|
|
33
156
|
* 使用 Fisher-Yates 算法对数组 **原地** 随机乱序。
|
|
34
157
|
* @template T
|
|
@@ -46,6 +169,62 @@ declare function shuffle<T>(arr: T[]): T[];
|
|
|
46
169
|
*/
|
|
47
170
|
declare function moveItem<T>(arr: T[], fromIndex: number, toIndex: number): T[];
|
|
48
171
|
|
|
172
|
+
/**
|
|
173
|
+
* 将 16-bit 单声道 PCM 数据封装成标准 WAV Blob。
|
|
174
|
+
*
|
|
175
|
+
* @param {Int16Array} pcmData - PCM 采样数据
|
|
176
|
+
* @param {number} [sampleRate=16000] - 采样率,默认 16 kHz
|
|
177
|
+
* @returns {Blob} audio/wav Blob
|
|
178
|
+
*/
|
|
179
|
+
declare function pcmToWavBlob(pcmData: Int16Array, sampleRate?: number): Blob;
|
|
180
|
+
/**
|
|
181
|
+
* 浏览器端实时音频流重采样器。
|
|
182
|
+
* 基于 AudioWorklet 将麦克风/媒体流转换为 16 kHz、16-bit、单声道 PCM,
|
|
183
|
+
* 并通过回调逐块输出,可选保存完整 PCM 用于后续合并。
|
|
184
|
+
*/
|
|
185
|
+
declare class AudioStreamResampler {
|
|
186
|
+
/**
|
|
187
|
+
* @param {object} config
|
|
188
|
+
* @param {function(Int16Array)} config.onData - 收到一个 chunk PCM 数据的回调
|
|
189
|
+
* @param {function(string, string)} [config.onStateChange] - 状态变化回调
|
|
190
|
+
* @param {object} [config.processorOptions] - 传递给 AudioWorklet 的选项
|
|
191
|
+
* @param {boolean} [config.saveFullPcm=false] - 是否在内部保存所有 PCM 用于 stop 时合并(长时间录音建议关闭)
|
|
192
|
+
*/
|
|
193
|
+
constructor(config: {
|
|
194
|
+
onData: (arg0: Int16Array) => any;
|
|
195
|
+
onStateChange?: ((arg0: string, arg1: string) => any) | undefined;
|
|
196
|
+
processorOptions?: object | undefined;
|
|
197
|
+
saveFullPcm?: boolean | undefined;
|
|
198
|
+
});
|
|
199
|
+
onData: (arg0: Int16Array) => any;
|
|
200
|
+
onStateChange: (arg0: string, arg1: string) => any;
|
|
201
|
+
processorOptions: object;
|
|
202
|
+
saveFullPcm: boolean;
|
|
203
|
+
audioContext: AudioContext | null;
|
|
204
|
+
workletNode: AudioWorkletNode | null;
|
|
205
|
+
source: MediaStreamAudioSourceNode | null;
|
|
206
|
+
workletUrl: string | null;
|
|
207
|
+
fullPcmData: never[] | null;
|
|
208
|
+
isInitialized: boolean;
|
|
209
|
+
isProcessing: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* 初始化 AudioContext 并加载 AudioWorklet。
|
|
212
|
+
* 完成后状态变为 `"ready"`。
|
|
213
|
+
*/
|
|
214
|
+
init(): Promise<void>;
|
|
215
|
+
/**
|
|
216
|
+
* 绑定媒体流,开始实时处理。
|
|
217
|
+
* @param {MediaStream} stream - 通过 getUserMedia 或其他方式获得的流
|
|
218
|
+
*/
|
|
219
|
+
setMediaStream(stream: MediaStream): void;
|
|
220
|
+
/**
|
|
221
|
+
* 停止处理并释放资源。
|
|
222
|
+
* @param {(fullPcm: Int16Array) => void} [callback] - 若构造时 `saveFullPcm=true`,会把合并后的完整 PCM 通过此回调传出
|
|
223
|
+
*/
|
|
224
|
+
stop(callback?: (fullPcm: Int16Array) => void): void;
|
|
225
|
+
_cleanup(): void;
|
|
226
|
+
}
|
|
227
|
+
|
|
49
228
|
/**
|
|
50
229
|
* 视口尺寸对象。
|
|
51
230
|
* @typedef {Object} ViewportDimensions
|
|
@@ -101,7 +280,7 @@ type ViewportDimensions = {
|
|
|
101
280
|
* @param {*} obj 待检测的值
|
|
102
281
|
* @returns {keyof globalThis|"blob"|"file"|"formdata"|string} 小写类型名
|
|
103
282
|
*/
|
|
104
|
-
declare function getDataType(obj: any): ("undefined" | "globalThis" | "eval" | "parseInt" | "parseFloat" | "isNaN" | "isFinite" | "decodeURI" | "decodeURIComponent" | "encodeURI" | "encodeURIComponent" | "escape" | "unescape" | "NaN" | "Infinity" | "Symbol" | "Object" | "Function" | "String" | "Boolean" | "Number" | "Math" | "Date" | "RegExp" | "Error" | "EvalError" | "RangeError" | "ReferenceError" | "SyntaxError" | "TypeError" | "URIError" | "JSON" | "Array" | "Promise" | "ArrayBuffer" | "DataView" | "Int8Array" | "Uint8Array" | "Uint8ClampedArray" | "Int16Array" | "Uint16Array" | "Int32Array" | "Uint32Array" | "Float32Array" | "Float64Array" | "Intl" | "alert" | "blur" | "cancelIdleCallback" | "captureEvents" | "close" | "confirm" | "focus" | "getComputedStyle" | "getSelection" | "matchMedia" | "moveBy" | "moveTo" | "open" | "postMessage" | "print" | "prompt" | "releaseEvents" | "requestIdleCallback" | "resizeBy" | "resizeTo" | "scroll" | "scrollBy" | "scrollTo" | "stop" | "toString" | "dispatchEvent" | "cancelAnimationFrame" | "requestAnimationFrame" | "atob" | "btoa" | "clearInterval" | "clearTimeout" | "createImageBitmap" | "fetch" | "queueMicrotask" | "reportError" | "setInterval" | "setTimeout" | "structuredClone" | "addEventListener" | "removeEventListener" | "NodeFilter" | "AbortController" | "AbortSignal" | "AbstractRange" | "AnalyserNode" | "Animation" | "AnimationEffect" | "AnimationEvent" | "AnimationPlaybackEvent" | "AnimationTimeline" | "Attr" | "AudioBuffer" | "AudioBufferSourceNode" | "AudioContext" | "AudioData" | "AudioDecoder" | "AudioDestinationNode" | "AudioEncoder" | "AudioListener" | "AudioNode" | "AudioParam" | "AudioParamMap" | "AudioProcessingEvent" | "AudioScheduledSourceNode" | "AudioWorklet" | "AudioWorkletNode" | "AuthenticatorAssertionResponse" | "AuthenticatorAttestationResponse" | "AuthenticatorResponse" | "BarProp" | "BaseAudioContext" | "BeforeUnloadEvent" | "BiquadFilterNode" | "Blob" | "BlobEvent" | "BroadcastChannel" | "ByteLengthQueuingStrategy" | "CDATASection" | "CSPViolationReportBody" | "CSSAnimation" | "CSSConditionRule" | "CSSContainerRule" | "CSSCounterStyleRule" | "CSSFontFaceRule" | "CSSFontFeatureValuesRule" | "CSSFontPaletteValuesRule" | "CSSGroupingRule" | "CSSImageValue" | "CSSImportRule" | "CSSKeyframeRule" | "CSSKeyframesRule" | "CSSKeywordValue" | "CSSLayerBlockRule" | "CSSLayerStatementRule" | "CSSMathClamp" | "CSSMathInvert" | "CSSMathMax" | "CSSMathMin" | "CSSMathNegate" | "CSSMathProduct" | "CSSMathSum" | "CSSMathValue" | "CSSMatrixComponent" | "CSSMediaRule" | "CSSNamespaceRule" | "CSSNestedDeclarations" | "CSSNumericArray" | "CSSNumericValue" | "CSSPageRule" | "CSSPerspective" | "CSSPropertyRule" | "CSSRotate" | "CSSRule" | "CSSRuleList" | "CSSScale" | "CSSScopeRule" | "CSSSkew" | "CSSSkewX" | "CSSSkewY" | "CSSStartingStyleRule" | "CSSStyleDeclaration" | "CSSStyleRule" | "CSSStyleSheet" | "CSSStyleValue" | "CSSSupportsRule" | "CSSTransformComponent" | "CSSTransformValue" | "CSSTransition" | "CSSTranslate" | "CSSUnitValue" | "CSSUnparsedValue" | "CSSVariableReferenceValue" | "CSSViewTransitionRule" | "Cache" | "CacheStorage" | "CanvasCaptureMediaStreamTrack" | "CanvasGradient" | "CanvasPattern" | "CanvasRenderingContext2D" | "CaretPosition" | "ChannelMergerNode" | "ChannelSplitterNode" | "CharacterData" | "Clipboard" | "ClipboardEvent" | "ClipboardItem" | "CloseEvent" | "Comment" | "CompositionEvent" | "CompressionStream" | "ConstantSourceNode" | "ContentVisibilityAutoStateChangeEvent" | "ConvolverNode" | "CookieChangeEvent" | "CookieStore" | "CookieStoreManager" | "CountQueuingStrategy" | "Credential" | "CredentialsContainer" | "Crypto" | "CryptoKey" | "CustomElementRegistry" | "CustomEvent" | "CustomStateSet" | "DOMException" | "DOMImplementation" | "DOMMatrix" | "SVGMatrix" | "WebKitCSSMatrix" | "DOMMatrixReadOnly" | "DOMParser" | "DOMPoint" | "SVGPoint" | "DOMPointReadOnly" | "DOMQuad" | "DOMRect" | "SVGRect" | "DOMRectList" | "DOMRectReadOnly" | "DOMStringList" | "DOMStringMap" | "DOMTokenList" | "DataTransfer" | "DataTransferItem" | "DataTransferItemList" | "DecompressionStream" | "DelayNode" | "DeviceMotionEvent" | "DeviceOrientationEvent" | "Document" | "DocumentFragment" | "DocumentTimeline" | "DocumentType" | "DragEvent" | "DynamicsCompressorNode" | "Element" | "ElementInternals" | "EncodedAudioChunk" | "EncodedVideoChunk" | "ErrorEvent" | "Event" | "EventCounts" | "EventSource" | "EventTarget" | "External" | "File" | "FileList" | "FileReader" | "FileSystem" | "FileSystemDirectoryEntry" | "FileSystemDirectoryHandle" | "FileSystemDirectoryReader" | "FileSystemEntry" | "FileSystemFileEntry" | "FileSystemFileHandle" | "FileSystemHandle" | "FileSystemWritableFileStream" | "FocusEvent" | "FontFace" | "FontFaceSet" | "FontFaceSetLoadEvent" | "FormData" | "FormDataEvent" | "FragmentDirective" | "GainNode" | "Gamepad" | "GamepadButton" | "GamepadEvent" | "GamepadHapticActuator" | "Geolocation" | "GeolocationCoordinates" | "GeolocationPosition" | "GeolocationPositionError" | "HTMLAllCollection" | "HTMLAnchorElement" | "HTMLAreaElement" | "HTMLAudioElement" | "HTMLBRElement" | "HTMLBaseElement" | "HTMLBodyElement" | "HTMLButtonElement" | "HTMLCanvasElement" | "HTMLCollection" | "HTMLDListElement" | "HTMLDataElement" | "HTMLDataListElement" | "HTMLDetailsElement" | "HTMLDialogElement" | "HTMLDirectoryElement" | "HTMLDivElement" | "HTMLDocument" | "HTMLElement" | "HTMLEmbedElement" | "HTMLFieldSetElement" | "HTMLFontElement" | "HTMLFormControlsCollection" | "HTMLFormElement" | "HTMLFrameElement" | "HTMLFrameSetElement" | "HTMLHRElement" | "HTMLHeadElement" | "HTMLHeadingElement" | "HTMLHtmlElement" | "HTMLIFrameElement" | "HTMLImageElement" | "HTMLInputElement" | "HTMLLIElement" | "HTMLLabelElement" | "HTMLLegendElement" | "HTMLLinkElement" | "HTMLMapElement" | "HTMLMarqueeElement" | "HTMLMediaElement" | "HTMLMenuElement" | "HTMLMetaElement" | "HTMLMeterElement" | "HTMLModElement" | "HTMLOListElement" | "HTMLObjectElement" | "HTMLOptGroupElement" | "HTMLOptionElement" | "HTMLOptionsCollection" | "HTMLOutputElement" | "HTMLParagraphElement" | "HTMLParamElement" | "HTMLPictureElement" | "HTMLPreElement" | "HTMLProgressElement" | "HTMLQuoteElement" | "HTMLScriptElement" | "HTMLSelectElement" | "HTMLSlotElement" | "HTMLSourceElement" | "HTMLSpanElement" | "HTMLStyleElement" | "HTMLTableCaptionElement" | "HTMLTableCellElement" | "HTMLTableColElement" | "HTMLTableElement" | "HTMLTableRowElement" | "HTMLTableSectionElement" | "HTMLTemplateElement" | "HTMLTextAreaElement" | "HTMLTimeElement" | "HTMLTitleElement" | "HTMLTrackElement" | "HTMLUListElement" | "HTMLUnknownElement" | "HTMLVideoElement" | "HashChangeEvent" | "Headers" | "Highlight" | "HighlightRegistry" | "History" | "IDBCursor" | "IDBCursorWithValue" | "IDBDatabase" | "IDBFactory" | "IDBIndex" | "IDBKeyRange" | "IDBObjectStore" | "IDBOpenDBRequest" | "IDBRequest" | "IDBTransaction" | "IDBVersionChangeEvent" | "IIRFilterNode" | "IdleDeadline" | "ImageBitmap" | "ImageBitmapRenderingContext" | "ImageCapture" | "ImageData" | "ImageDecoder" | "ImageTrack" | "ImageTrackList" | "InputDeviceInfo" | "InputEvent" | "IntersectionObserver" | "IntersectionObserverEntry" | "KeyboardEvent" | "KeyframeEffect" | "LargestContentfulPaint" | "Location" | "Lock" | "LockManager" | "MIDIAccess" | "MIDIConnectionEvent" | "MIDIInput" | "MIDIInputMap" | "MIDIMessageEvent" | "MIDIOutput" | "MIDIOutputMap" | "MIDIPort" | "MathMLElement" | "MediaCapabilities" | "MediaDeviceInfo" | "MediaDevices" | "MediaElementAudioSourceNode" | "MediaEncryptedEvent" | "MediaError" | "MediaKeyMessageEvent" | "MediaKeySession" | "MediaKeyStatusMap" | "MediaKeySystemAccess" | "MediaKeys" | "MediaList" | "MediaMetadata" | "MediaQueryList" | "MediaQueryListEvent" | "MediaRecorder" | "MediaSession" | "MediaSource" | "MediaSourceHandle" | "MediaStream" | "MediaStreamAudioDestinationNode" | "MediaStreamAudioSourceNode" | "MediaStreamTrack" | "MediaStreamTrackEvent" | "MessageChannel" | "MessageEvent" | "MessagePort" | "MimeType" | "MimeTypeArray" | "MouseEvent" | "MutationObserver" | "MutationRecord" | "NamedNodeMap" | "NavigationActivation" | "NavigationHistoryEntry" | "NavigationPreloadManager" | "Navigator" | "NavigatorLogin" | "Node" | "NodeIterator" | "NodeList" | "Notification" | "OfflineAudioCompletionEvent" | "OfflineAudioContext" | "OffscreenCanvas" | "OffscreenCanvasRenderingContext2D" | "OscillatorNode" | "OverconstrainedError" | "PageRevealEvent" | "PageSwapEvent" | "PageTransitionEvent" | "PannerNode" | "Path2D" | "PaymentAddress" | "PaymentMethodChangeEvent" | "PaymentRequest" | "PaymentRequestUpdateEvent" | "PaymentResponse" | "Performance" | "PerformanceEntry" | "PerformanceEventTiming" | "PerformanceMark" | "PerformanceMeasure" | "PerformanceNavigation" | "PerformanceNavigationTiming" | "PerformanceObserver" | "PerformanceObserverEntryList" | "PerformancePaintTiming" | "PerformanceResourceTiming" | "PerformanceServerTiming" | "PerformanceTiming" | "PeriodicWave" | "PermissionStatus" | "Permissions" | "PictureInPictureEvent" | "PictureInPictureWindow" | "Plugin" | "PluginArray" | "PointerEvent" | "PopStateEvent" | "ProcessingInstruction" | "ProgressEvent" | "PromiseRejectionEvent" | "PublicKeyCredential" | "PushManager" | "PushSubscription" | "PushSubscriptionOptions" | "RTCCertificate" | "RTCDTMFSender" | "RTCDTMFToneChangeEvent" | "RTCDataChannel" | "RTCDataChannelEvent" | "RTCDtlsTransport" | "RTCEncodedAudioFrame" | "RTCEncodedVideoFrame" | "RTCError" | "RTCErrorEvent" | "RTCIceCandidate" | "RTCIceTransport" | "RTCPeerConnection" | "RTCPeerConnectionIceErrorEvent" | "RTCPeerConnectionIceEvent" | "RTCRtpReceiver" | "RTCRtpScriptTransform" | "RTCRtpSender" | "RTCRtpTransceiver" | "RTCSctpTransport" | "RTCSessionDescription" | "RTCStatsReport" | "RTCTrackEvent" | "RadioNodeList" | "Range" | "ReadableByteStreamController" | "ReadableStream" | "ReadableStreamBYOBReader" | "ReadableStreamBYOBRequest" | "ReadableStreamDefaultController" | "ReadableStreamDefaultReader" | "RemotePlayback" | "Report" | "ReportBody" | "ReportingObserver" | "Request" | "ResizeObserver" | "ResizeObserverEntry" | "ResizeObserverSize" | "Response" | "SVGAElement" | "SVGAngle" | "SVGAnimateElement" | "SVGAnimateMotionElement" | "SVGAnimateTransformElement" | "SVGAnimatedAngle" | "SVGAnimatedBoolean" | "SVGAnimatedEnumeration" | "SVGAnimatedInteger" | "SVGAnimatedLength" | "SVGAnimatedLengthList" | "SVGAnimatedNumber" | "SVGAnimatedNumberList" | "SVGAnimatedPreserveAspectRatio" | "SVGAnimatedRect" | "SVGAnimatedString" | "SVGAnimatedTransformList" | "SVGAnimationElement" | "SVGCircleElement" | "SVGClipPathElement" | "SVGComponentTransferFunctionElement" | "SVGDefsElement" | "SVGDescElement" | "SVGElement" | "SVGEllipseElement" | "SVGFEBlendElement" | "SVGFEColorMatrixElement" | "SVGFEComponentTransferElement" | "SVGFECompositeElement" | "SVGFEConvolveMatrixElement" | "SVGFEDiffuseLightingElement" | "SVGFEDisplacementMapElement" | "SVGFEDistantLightElement" | "SVGFEDropShadowElement" | "SVGFEFloodElement" | "SVGFEFuncAElement" | "SVGFEFuncBElement" | "SVGFEFuncGElement" | "SVGFEFuncRElement" | "SVGFEGaussianBlurElement" | "SVGFEImageElement" | "SVGFEMergeElement" | "SVGFEMergeNodeElement" | "SVGFEMorphologyElement" | "SVGFEOffsetElement" | "SVGFEPointLightElement" | "SVGFESpecularLightingElement" | "SVGFESpotLightElement" | "SVGFETileElement" | "SVGFETurbulenceElement" | "SVGFilterElement" | "SVGForeignObjectElement" | "SVGGElement" | "SVGGeometryElement" | "SVGGradientElement" | "SVGGraphicsElement" | "SVGImageElement" | "SVGLength" | "SVGLengthList" | "SVGLineElement" | "SVGLinearGradientElement" | "SVGMPathElement" | "SVGMarkerElement" | "SVGMaskElement" | "SVGMetadataElement" | "SVGNumber" | "SVGNumberList" | "SVGPathElement" | "SVGPatternElement" | "SVGPointList" | "SVGPolygonElement" | "SVGPolylineElement" | "SVGPreserveAspectRatio" | "SVGRadialGradientElement" | "SVGRectElement" | "SVGSVGElement" | "SVGScriptElement" | "SVGSetElement" | "SVGStopElement" | "SVGStringList" | "SVGStyleElement" | "SVGSwitchElement" | "SVGSymbolElement" | "SVGTSpanElement" | "SVGTextContentElement" | "SVGTextElement" | "SVGTextPathElement" | "SVGTextPositioningElement" | "SVGTitleElement" | "SVGTransform" | "SVGTransformList" | "SVGUnitTypes" | "SVGUseElement" | "SVGViewElement" | "Screen" | "ScreenOrientation" | "ScriptProcessorNode" | "SecurityPolicyViolationEvent" | "Selection" | "ServiceWorker" | "ServiceWorkerContainer" | "ServiceWorkerRegistration" | "ShadowRoot" | "SharedWorker" | "SourceBuffer" | "SourceBufferList" | "SpeechRecognitionAlternative" | "SpeechRecognitionResult" | "SpeechRecognitionResultList" | "SpeechSynthesis" | "SpeechSynthesisErrorEvent" | "SpeechSynthesisEvent" | "SpeechSynthesisUtterance" | "SpeechSynthesisVoice" | "StaticRange" | "StereoPannerNode" | "Storage" | "StorageEvent" | "StorageManager" | "StylePropertyMap" | "StylePropertyMapReadOnly" | "StyleSheet" | "StyleSheetList" | "SubmitEvent" | "SubtleCrypto" | "Text" | "TextDecoder" | "TextDecoderStream" | "TextEncoder" | "TextEncoderStream" | "TextEvent" | "TextMetrics" | "TextTrack" | "TextTrackCue" | "TextTrackCueList" | "TextTrackList" | "TimeRanges" | "ToggleEvent" | "Touch" | "TouchEvent" | "TouchList" | "TrackEvent" | "TransformStream" | "TransformStreamDefaultController" | "TransitionEvent" | "TreeWalker" | "UIEvent" | "URL" | "webkitURL" | "URLSearchParams" | "UserActivation" | "VTTCue" | "VTTRegion" | "ValidityState" | "VideoColorSpace" | "VideoDecoder" | "VideoEncoder" | "VideoFrame" | "VideoPlaybackQuality" | "ViewTransition" | "ViewTransitionTypeSet" | "VisualViewport" | "WakeLock" | "WakeLockSentinel" | "WaveShaperNode" | "WebGL2RenderingContext" | "WebGLActiveInfo" | "WebGLBuffer" | "WebGLContextEvent" | "WebGLFramebuffer" | "WebGLProgram" | "WebGLQuery" | "WebGLRenderbuffer" | "WebGLRenderingContext" | "WebGLSampler" | "WebGLShader" | "WebGLShaderPrecisionFormat" | "WebGLSync" | "WebGLTexture" | "WebGLTransformFeedback" | "WebGLUniformLocation" | "WebGLVertexArrayObject" | "WebSocket" | "WebTransport" | "WebTransportBidirectionalStream" | "WebTransportDatagramDuplexStream" | "WebTransportError" | "WheelEvent" | "Window" | "Worker" | "Worklet" | "WritableStream" | "WritableStreamDefaultController" | "WritableStreamDefaultWriter" | "XMLDocument" | "XMLHttpRequest" | "XMLHttpRequestEventTarget" | "XMLHttpRequestUpload" | "XMLSerializer" | "XPathEvaluator" | "XPathExpression" | "XPathResult" | "XSLTProcessor" | "CSS" | "WebAssembly" | "console" | "Audio" | "Image" | "Option" | "clientInformation" | "closed" | "cookieStore" | "customElements" | "devicePixelRatio" | "document" | "event" | "external" | "frameElement" | "frames" | "history" | "innerHeight" | "innerWidth" | "length" | "location" | "locationbar" | "menubar" | "navigator" | "ondevicemotion" | "ondeviceorientation" | "ondeviceorientationabsolute" | "onorientationchange" | "opener" | "orientation" | "originAgentCluster" | "outerHeight" | "outerWidth" | "pageXOffset" | "pageYOffset" | "parent" | "personalbar" | "screen" | "screenLeft" | "screenTop" | "screenX" | "screenY" | "scrollX" | "scrollY" | "scrollbars" | "self" | "speechSynthesis" | "status" | "statusbar" | "toolbar" | "top" | "visualViewport" | "window" | "onabort" | "onanimationcancel" | "onanimationend" | "onanimationiteration" | "onanimationstart" | "onauxclick" | "onbeforeinput" | "onbeforematch" | "onbeforetoggle" | "onblur" | "oncancel" | "oncanplay" | "oncanplaythrough" | "onchange" | "onclick" | "onclose" | "oncontextlost" | "oncontextmenu" | "oncontextrestored" | "oncopy" | "oncuechange" | "oncut" | "ondblclick" | "ondrag" | "ondragend" | "ondragenter" | "ondragleave" | "ondragover" | "ondragstart" | "ondrop" | "ondurationchange" | "onemptied" | "onended" | "onerror" | "onfocus" | "onformdata" | "ongotpointercapture" | "oninput" | "oninvalid" | "onkeydown" | "onkeypress" | "onkeyup" | "onload" | "onloadeddata" | "onloadedmetadata" | "onloadstart" | "onlostpointercapture" | "onmousedown" | "onmouseenter" | "onmouseleave" | "onmousemove" | "onmouseout" | "onmouseover" | "onmouseup" | "onpaste" | "onpause" | "onplay" | "onplaying" | "onpointercancel" | "onpointerdown" | "onpointerenter" | "onpointerleave" | "onpointermove" | "onpointerout" | "onpointerover" | "onpointerrawupdate" | "onpointerup" | "onprogress" | "onratechange" | "onreset" | "onresize" | "onscroll" | "onscrollend" | "onsecuritypolicyviolation" | "onseeked" | "onseeking" | "onselect" | "onselectionchange" | "onselectstart" | "onslotchange" | "onstalled" | "onsubmit" | "onsuspend" | "ontimeupdate" | "ontoggle" | "ontouchcancel" | "ontouchend" | "ontouchmove" | "ontouchstart" | "ontransitioncancel" | "ontransitionend" | "ontransitionrun" | "ontransitionstart" | "onvolumechange" | "onwaiting" | "onwebkitanimationend" | "onwebkitanimationiteration" | "onwebkitanimationstart" | "onwebkittransitionend" | "onwheel" | "onafterprint" | "onbeforeprint" | "onbeforeunload" | "ongamepadconnected" | "ongamepaddisconnected" | "onhashchange" | "onlanguagechange" | "onmessage" | "onmessageerror" | "onoffline" | "ononline" | "onpagehide" | "onpagereveal" | "onpageshow" | "onpageswap" | "onpopstate" | "onrejectionhandled" | "onstorage" | "onunhandledrejection" | "onunload" | "localStorage" | "caches" | "crossOriginIsolated" | "crypto" | "indexedDB" | "isSecureContext" | "origin" | "performance" | "sessionStorage" | "importScripts" | "ActiveXObject" | "WScript" | "WSH" | "Enumerator" | "VBArray" | "Map" | "WeakMap" | "Set" | "WeakSet" | "Iterator" | "Proxy" | "Reflect" | "SharedArrayBuffer" | "Atomics" | "BigInt" | "BigInt64Array" | "BigUint64Array" | "AggregateError" | "WeakRef" | "FinalizationRegistry" | "SuppressedError" | "DisposableStack" | "AsyncDisposableStack" | "Float16Array") | "blob" | "file" | "formdata" | string;
|
|
283
|
+
declare function getDataType(obj: any): ("undefined" | "length" | "toString" | "ArrayBuffer" | "SharedArrayBuffer" | "globalThis" | "eval" | "parseInt" | "parseFloat" | "isNaN" | "isFinite" | "decodeURI" | "decodeURIComponent" | "encodeURI" | "encodeURIComponent" | "escape" | "unescape" | "NaN" | "Infinity" | "Symbol" | "Object" | "Function" | "String" | "Boolean" | "Number" | "Math" | "Date" | "RegExp" | "Error" | "EvalError" | "RangeError" | "ReferenceError" | "SyntaxError" | "TypeError" | "URIError" | "JSON" | "Array" | "Promise" | "DataView" | "Int8Array" | "Uint8Array" | "Uint8ClampedArray" | "Int16Array" | "Uint16Array" | "Int32Array" | "Uint32Array" | "Float32Array" | "Float64Array" | "Intl" | "alert" | "blur" | "cancelIdleCallback" | "captureEvents" | "close" | "confirm" | "focus" | "getComputedStyle" | "getSelection" | "matchMedia" | "moveBy" | "moveTo" | "open" | "postMessage" | "print" | "prompt" | "releaseEvents" | "requestIdleCallback" | "resizeBy" | "resizeTo" | "scroll" | "scrollBy" | "scrollTo" | "stop" | "dispatchEvent" | "cancelAnimationFrame" | "requestAnimationFrame" | "atob" | "btoa" | "clearInterval" | "clearTimeout" | "createImageBitmap" | "fetch" | "queueMicrotask" | "reportError" | "setInterval" | "setTimeout" | "structuredClone" | "addEventListener" | "removeEventListener" | "NodeFilter" | "AbortController" | "AbortSignal" | "AbstractRange" | "AnalyserNode" | "Animation" | "AnimationEffect" | "AnimationEvent" | "AnimationPlaybackEvent" | "AnimationTimeline" | "Attr" | "AudioBuffer" | "AudioBufferSourceNode" | "AudioContext" | "AudioData" | "AudioDecoder" | "AudioDestinationNode" | "AudioEncoder" | "AudioListener" | "AudioNode" | "AudioParam" | "AudioParamMap" | "AudioProcessingEvent" | "AudioScheduledSourceNode" | "AudioWorklet" | "AudioWorkletNode" | "AuthenticatorAssertionResponse" | "AuthenticatorAttestationResponse" | "AuthenticatorResponse" | "BarProp" | "BaseAudioContext" | "BeforeUnloadEvent" | "BiquadFilterNode" | "Blob" | "BlobEvent" | "BroadcastChannel" | "ByteLengthQueuingStrategy" | "CDATASection" | "CSPViolationReportBody" | "CSSAnimation" | "CSSConditionRule" | "CSSContainerRule" | "CSSCounterStyleRule" | "CSSFontFaceRule" | "CSSFontFeatureValuesRule" | "CSSFontPaletteValuesRule" | "CSSGroupingRule" | "CSSImageValue" | "CSSImportRule" | "CSSKeyframeRule" | "CSSKeyframesRule" | "CSSKeywordValue" | "CSSLayerBlockRule" | "CSSLayerStatementRule" | "CSSMathClamp" | "CSSMathInvert" | "CSSMathMax" | "CSSMathMin" | "CSSMathNegate" | "CSSMathProduct" | "CSSMathSum" | "CSSMathValue" | "CSSMatrixComponent" | "CSSMediaRule" | "CSSNamespaceRule" | "CSSNestedDeclarations" | "CSSNumericArray" | "CSSNumericValue" | "CSSPageRule" | "CSSPerspective" | "CSSPropertyRule" | "CSSRotate" | "CSSRule" | "CSSRuleList" | "CSSScale" | "CSSScopeRule" | "CSSSkew" | "CSSSkewX" | "CSSSkewY" | "CSSStartingStyleRule" | "CSSStyleDeclaration" | "CSSStyleRule" | "CSSStyleSheet" | "CSSStyleValue" | "CSSSupportsRule" | "CSSTransformComponent" | "CSSTransformValue" | "CSSTransition" | "CSSTranslate" | "CSSUnitValue" | "CSSUnparsedValue" | "CSSVariableReferenceValue" | "CSSViewTransitionRule" | "Cache" | "CacheStorage" | "CanvasCaptureMediaStreamTrack" | "CanvasGradient" | "CanvasPattern" | "CanvasRenderingContext2D" | "CaretPosition" | "ChannelMergerNode" | "ChannelSplitterNode" | "CharacterData" | "Clipboard" | "ClipboardEvent" | "ClipboardItem" | "CloseEvent" | "Comment" | "CompositionEvent" | "CompressionStream" | "ConstantSourceNode" | "ContentVisibilityAutoStateChangeEvent" | "ConvolverNode" | "CookieChangeEvent" | "CookieStore" | "CookieStoreManager" | "CountQueuingStrategy" | "Credential" | "CredentialsContainer" | "Crypto" | "CryptoKey" | "CustomElementRegistry" | "CustomEvent" | "CustomStateSet" | "DOMException" | "DOMImplementation" | "DOMMatrix" | "SVGMatrix" | "WebKitCSSMatrix" | "DOMMatrixReadOnly" | "DOMParser" | "DOMPoint" | "SVGPoint" | "DOMPointReadOnly" | "DOMQuad" | "DOMRect" | "SVGRect" | "DOMRectList" | "DOMRectReadOnly" | "DOMStringList" | "DOMStringMap" | "DOMTokenList" | "DataTransfer" | "DataTransferItem" | "DataTransferItemList" | "DecompressionStream" | "DelayNode" | "DeviceMotionEvent" | "DeviceOrientationEvent" | "Document" | "DocumentFragment" | "DocumentTimeline" | "DocumentType" | "DragEvent" | "DynamicsCompressorNode" | "Element" | "ElementInternals" | "EncodedAudioChunk" | "EncodedVideoChunk" | "ErrorEvent" | "Event" | "EventCounts" | "EventSource" | "EventTarget" | "External" | "File" | "FileList" | "FileReader" | "FileSystem" | "FileSystemDirectoryEntry" | "FileSystemDirectoryHandle" | "FileSystemDirectoryReader" | "FileSystemEntry" | "FileSystemFileEntry" | "FileSystemFileHandle" | "FileSystemHandle" | "FileSystemWritableFileStream" | "FocusEvent" | "FontFace" | "FontFaceSet" | "FontFaceSetLoadEvent" | "FormData" | "FormDataEvent" | "FragmentDirective" | "GainNode" | "Gamepad" | "GamepadButton" | "GamepadEvent" | "GamepadHapticActuator" | "Geolocation" | "GeolocationCoordinates" | "GeolocationPosition" | "GeolocationPositionError" | "HTMLAllCollection" | "HTMLAnchorElement" | "HTMLAreaElement" | "HTMLAudioElement" | "HTMLBRElement" | "HTMLBaseElement" | "HTMLBodyElement" | "HTMLButtonElement" | "HTMLCanvasElement" | "HTMLCollection" | "HTMLDListElement" | "HTMLDataElement" | "HTMLDataListElement" | "HTMLDetailsElement" | "HTMLDialogElement" | "HTMLDirectoryElement" | "HTMLDivElement" | "HTMLDocument" | "HTMLElement" | "HTMLEmbedElement" | "HTMLFieldSetElement" | "HTMLFontElement" | "HTMLFormControlsCollection" | "HTMLFormElement" | "HTMLFrameElement" | "HTMLFrameSetElement" | "HTMLHRElement" | "HTMLHeadElement" | "HTMLHeadingElement" | "HTMLHtmlElement" | "HTMLIFrameElement" | "HTMLImageElement" | "HTMLInputElement" | "HTMLLIElement" | "HTMLLabelElement" | "HTMLLegendElement" | "HTMLLinkElement" | "HTMLMapElement" | "HTMLMarqueeElement" | "HTMLMediaElement" | "HTMLMenuElement" | "HTMLMetaElement" | "HTMLMeterElement" | "HTMLModElement" | "HTMLOListElement" | "HTMLObjectElement" | "HTMLOptGroupElement" | "HTMLOptionElement" | "HTMLOptionsCollection" | "HTMLOutputElement" | "HTMLParagraphElement" | "HTMLParamElement" | "HTMLPictureElement" | "HTMLPreElement" | "HTMLProgressElement" | "HTMLQuoteElement" | "HTMLScriptElement" | "HTMLSelectElement" | "HTMLSlotElement" | "HTMLSourceElement" | "HTMLSpanElement" | "HTMLStyleElement" | "HTMLTableCaptionElement" | "HTMLTableCellElement" | "HTMLTableColElement" | "HTMLTableElement" | "HTMLTableRowElement" | "HTMLTableSectionElement" | "HTMLTemplateElement" | "HTMLTextAreaElement" | "HTMLTimeElement" | "HTMLTitleElement" | "HTMLTrackElement" | "HTMLUListElement" | "HTMLUnknownElement" | "HTMLVideoElement" | "HashChangeEvent" | "Headers" | "Highlight" | "HighlightRegistry" | "History" | "IDBCursor" | "IDBCursorWithValue" | "IDBDatabase" | "IDBFactory" | "IDBIndex" | "IDBKeyRange" | "IDBObjectStore" | "IDBOpenDBRequest" | "IDBRequest" | "IDBTransaction" | "IDBVersionChangeEvent" | "IIRFilterNode" | "IdleDeadline" | "ImageBitmap" | "ImageBitmapRenderingContext" | "ImageCapture" | "ImageData" | "ImageDecoder" | "ImageTrack" | "ImageTrackList" | "InputDeviceInfo" | "InputEvent" | "IntersectionObserver" | "IntersectionObserverEntry" | "KeyboardEvent" | "KeyframeEffect" | "LargestContentfulPaint" | "Location" | "Lock" | "LockManager" | "MIDIAccess" | "MIDIConnectionEvent" | "MIDIInput" | "MIDIInputMap" | "MIDIMessageEvent" | "MIDIOutput" | "MIDIOutputMap" | "MIDIPort" | "MathMLElement" | "MediaCapabilities" | "MediaDeviceInfo" | "MediaDevices" | "MediaElementAudioSourceNode" | "MediaEncryptedEvent" | "MediaError" | "MediaKeyMessageEvent" | "MediaKeySession" | "MediaKeyStatusMap" | "MediaKeySystemAccess" | "MediaKeys" | "MediaList" | "MediaMetadata" | "MediaQueryList" | "MediaQueryListEvent" | "MediaRecorder" | "MediaSession" | "MediaSource" | "MediaSourceHandle" | "MediaStream" | "MediaStreamAudioDestinationNode" | "MediaStreamAudioSourceNode" | "MediaStreamTrack" | "MediaStreamTrackEvent" | "MessageChannel" | "MessageEvent" | "MessagePort" | "MimeType" | "MimeTypeArray" | "MouseEvent" | "MutationObserver" | "MutationRecord" | "NamedNodeMap" | "NavigationActivation" | "NavigationHistoryEntry" | "NavigationPreloadManager" | "Navigator" | "NavigatorLogin" | "Node" | "NodeIterator" | "NodeList" | "Notification" | "OfflineAudioCompletionEvent" | "OfflineAudioContext" | "OffscreenCanvas" | "OffscreenCanvasRenderingContext2D" | "OscillatorNode" | "OverconstrainedError" | "PageRevealEvent" | "PageSwapEvent" | "PageTransitionEvent" | "PannerNode" | "Path2D" | "PaymentAddress" | "PaymentMethodChangeEvent" | "PaymentRequest" | "PaymentRequestUpdateEvent" | "PaymentResponse" | "Performance" | "PerformanceEntry" | "PerformanceEventTiming" | "PerformanceMark" | "PerformanceMeasure" | "PerformanceNavigation" | "PerformanceNavigationTiming" | "PerformanceObserver" | "PerformanceObserverEntryList" | "PerformancePaintTiming" | "PerformanceResourceTiming" | "PerformanceServerTiming" | "PerformanceTiming" | "PeriodicWave" | "PermissionStatus" | "Permissions" | "PictureInPictureEvent" | "PictureInPictureWindow" | "Plugin" | "PluginArray" | "PointerEvent" | "PopStateEvent" | "ProcessingInstruction" | "ProgressEvent" | "PromiseRejectionEvent" | "PublicKeyCredential" | "PushManager" | "PushSubscription" | "PushSubscriptionOptions" | "RTCCertificate" | "RTCDTMFSender" | "RTCDTMFToneChangeEvent" | "RTCDataChannel" | "RTCDataChannelEvent" | "RTCDtlsTransport" | "RTCEncodedAudioFrame" | "RTCEncodedVideoFrame" | "RTCError" | "RTCErrorEvent" | "RTCIceCandidate" | "RTCIceTransport" | "RTCPeerConnection" | "RTCPeerConnectionIceErrorEvent" | "RTCPeerConnectionIceEvent" | "RTCRtpReceiver" | "RTCRtpScriptTransform" | "RTCRtpSender" | "RTCRtpTransceiver" | "RTCSctpTransport" | "RTCSessionDescription" | "RTCStatsReport" | "RTCTrackEvent" | "RadioNodeList" | "Range" | "ReadableByteStreamController" | "ReadableStream" | "ReadableStreamBYOBReader" | "ReadableStreamBYOBRequest" | "ReadableStreamDefaultController" | "ReadableStreamDefaultReader" | "RemotePlayback" | "Report" | "ReportBody" | "ReportingObserver" | "Request" | "ResizeObserver" | "ResizeObserverEntry" | "ResizeObserverSize" | "Response" | "SVGAElement" | "SVGAngle" | "SVGAnimateElement" | "SVGAnimateMotionElement" | "SVGAnimateTransformElement" | "SVGAnimatedAngle" | "SVGAnimatedBoolean" | "SVGAnimatedEnumeration" | "SVGAnimatedInteger" | "SVGAnimatedLength" | "SVGAnimatedLengthList" | "SVGAnimatedNumber" | "SVGAnimatedNumberList" | "SVGAnimatedPreserveAspectRatio" | "SVGAnimatedRect" | "SVGAnimatedString" | "SVGAnimatedTransformList" | "SVGAnimationElement" | "SVGCircleElement" | "SVGClipPathElement" | "SVGComponentTransferFunctionElement" | "SVGDefsElement" | "SVGDescElement" | "SVGElement" | "SVGEllipseElement" | "SVGFEBlendElement" | "SVGFEColorMatrixElement" | "SVGFEComponentTransferElement" | "SVGFECompositeElement" | "SVGFEConvolveMatrixElement" | "SVGFEDiffuseLightingElement" | "SVGFEDisplacementMapElement" | "SVGFEDistantLightElement" | "SVGFEDropShadowElement" | "SVGFEFloodElement" | "SVGFEFuncAElement" | "SVGFEFuncBElement" | "SVGFEFuncGElement" | "SVGFEFuncRElement" | "SVGFEGaussianBlurElement" | "SVGFEImageElement" | "SVGFEMergeElement" | "SVGFEMergeNodeElement" | "SVGFEMorphologyElement" | "SVGFEOffsetElement" | "SVGFEPointLightElement" | "SVGFESpecularLightingElement" | "SVGFESpotLightElement" | "SVGFETileElement" | "SVGFETurbulenceElement" | "SVGFilterElement" | "SVGForeignObjectElement" | "SVGGElement" | "SVGGeometryElement" | "SVGGradientElement" | "SVGGraphicsElement" | "SVGImageElement" | "SVGLength" | "SVGLengthList" | "SVGLineElement" | "SVGLinearGradientElement" | "SVGMPathElement" | "SVGMarkerElement" | "SVGMaskElement" | "SVGMetadataElement" | "SVGNumber" | "SVGNumberList" | "SVGPathElement" | "SVGPatternElement" | "SVGPointList" | "SVGPolygonElement" | "SVGPolylineElement" | "SVGPreserveAspectRatio" | "SVGRadialGradientElement" | "SVGRectElement" | "SVGSVGElement" | "SVGScriptElement" | "SVGSetElement" | "SVGStopElement" | "SVGStringList" | "SVGStyleElement" | "SVGSwitchElement" | "SVGSymbolElement" | "SVGTSpanElement" | "SVGTextContentElement" | "SVGTextElement" | "SVGTextPathElement" | "SVGTextPositioningElement" | "SVGTitleElement" | "SVGTransform" | "SVGTransformList" | "SVGUnitTypes" | "SVGUseElement" | "SVGViewElement" | "Screen" | "ScreenOrientation" | "ScriptProcessorNode" | "SecurityPolicyViolationEvent" | "Selection" | "ServiceWorker" | "ServiceWorkerContainer" | "ServiceWorkerRegistration" | "ShadowRoot" | "SharedWorker" | "SourceBuffer" | "SourceBufferList" | "SpeechRecognitionAlternative" | "SpeechRecognitionResult" | "SpeechRecognitionResultList" | "SpeechSynthesis" | "SpeechSynthesisErrorEvent" | "SpeechSynthesisEvent" | "SpeechSynthesisUtterance" | "SpeechSynthesisVoice" | "StaticRange" | "StereoPannerNode" | "Storage" | "StorageEvent" | "StorageManager" | "StylePropertyMap" | "StylePropertyMapReadOnly" | "StyleSheet" | "StyleSheetList" | "SubmitEvent" | "SubtleCrypto" | "Text" | "TextDecoder" | "TextDecoderStream" | "TextEncoder" | "TextEncoderStream" | "TextEvent" | "TextMetrics" | "TextTrack" | "TextTrackCue" | "TextTrackCueList" | "TextTrackList" | "TimeRanges" | "ToggleEvent" | "Touch" | "TouchEvent" | "TouchList" | "TrackEvent" | "TransformStream" | "TransformStreamDefaultController" | "TransitionEvent" | "TreeWalker" | "UIEvent" | "URL" | "webkitURL" | "URLSearchParams" | "UserActivation" | "VTTCue" | "VTTRegion" | "ValidityState" | "VideoColorSpace" | "VideoDecoder" | "VideoEncoder" | "VideoFrame" | "VideoPlaybackQuality" | "ViewTransition" | "ViewTransitionTypeSet" | "VisualViewport" | "WakeLock" | "WakeLockSentinel" | "WaveShaperNode" | "WebGL2RenderingContext" | "WebGLActiveInfo" | "WebGLBuffer" | "WebGLContextEvent" | "WebGLFramebuffer" | "WebGLProgram" | "WebGLQuery" | "WebGLRenderbuffer" | "WebGLRenderingContext" | "WebGLSampler" | "WebGLShader" | "WebGLShaderPrecisionFormat" | "WebGLSync" | "WebGLTexture" | "WebGLTransformFeedback" | "WebGLUniformLocation" | "WebGLVertexArrayObject" | "WebSocket" | "WebTransport" | "WebTransportBidirectionalStream" | "WebTransportDatagramDuplexStream" | "WebTransportError" | "WheelEvent" | "Window" | "Worker" | "Worklet" | "WritableStream" | "WritableStreamDefaultController" | "WritableStreamDefaultWriter" | "XMLDocument" | "XMLHttpRequest" | "XMLHttpRequestEventTarget" | "XMLHttpRequestUpload" | "XMLSerializer" | "XPathEvaluator" | "XPathExpression" | "XPathResult" | "XSLTProcessor" | "CSS" | "WebAssembly" | "console" | "Audio" | "Image" | "Option" | "clientInformation" | "closed" | "cookieStore" | "customElements" | "devicePixelRatio" | "document" | "event" | "external" | "frameElement" | "frames" | "history" | "innerHeight" | "innerWidth" | "location" | "locationbar" | "menubar" | "navigator" | "ondevicemotion" | "ondeviceorientation" | "ondeviceorientationabsolute" | "onorientationchange" | "opener" | "orientation" | "originAgentCluster" | "outerHeight" | "outerWidth" | "pageXOffset" | "pageYOffset" | "parent" | "personalbar" | "screen" | "screenLeft" | "screenTop" | "screenX" | "screenY" | "scrollX" | "scrollY" | "scrollbars" | "self" | "speechSynthesis" | "status" | "statusbar" | "toolbar" | "top" | "visualViewport" | "window" | "onabort" | "onanimationcancel" | "onanimationend" | "onanimationiteration" | "onanimationstart" | "onauxclick" | "onbeforeinput" | "onbeforematch" | "onbeforetoggle" | "onblur" | "oncancel" | "oncanplay" | "oncanplaythrough" | "onchange" | "onclick" | "onclose" | "oncontextlost" | "oncontextmenu" | "oncontextrestored" | "oncopy" | "oncuechange" | "oncut" | "ondblclick" | "ondrag" | "ondragend" | "ondragenter" | "ondragleave" | "ondragover" | "ondragstart" | "ondrop" | "ondurationchange" | "onemptied" | "onended" | "onerror" | "onfocus" | "onformdata" | "ongotpointercapture" | "oninput" | "oninvalid" | "onkeydown" | "onkeypress" | "onkeyup" | "onload" | "onloadeddata" | "onloadedmetadata" | "onloadstart" | "onlostpointercapture" | "onmousedown" | "onmouseenter" | "onmouseleave" | "onmousemove" | "onmouseout" | "onmouseover" | "onmouseup" | "onpaste" | "onpause" | "onplay" | "onplaying" | "onpointercancel" | "onpointerdown" | "onpointerenter" | "onpointerleave" | "onpointermove" | "onpointerout" | "onpointerover" | "onpointerrawupdate" | "onpointerup" | "onprogress" | "onratechange" | "onreset" | "onresize" | "onscroll" | "onscrollend" | "onsecuritypolicyviolation" | "onseeked" | "onseeking" | "onselect" | "onselectionchange" | "onselectstart" | "onslotchange" | "onstalled" | "onsubmit" | "onsuspend" | "ontimeupdate" | "ontoggle" | "ontouchcancel" | "ontouchend" | "ontouchmove" | "ontouchstart" | "ontransitioncancel" | "ontransitionend" | "ontransitionrun" | "ontransitionstart" | "onvolumechange" | "onwaiting" | "onwebkitanimationend" | "onwebkitanimationiteration" | "onwebkitanimationstart" | "onwebkittransitionend" | "onwheel" | "onafterprint" | "onbeforeprint" | "onbeforeunload" | "ongamepadconnected" | "ongamepaddisconnected" | "onhashchange" | "onlanguagechange" | "onmessage" | "onmessageerror" | "onoffline" | "ononline" | "onpagehide" | "onpagereveal" | "onpageshow" | "onpageswap" | "onpopstate" | "onrejectionhandled" | "onstorage" | "onunhandledrejection" | "onunload" | "localStorage" | "caches" | "crossOriginIsolated" | "crypto" | "indexedDB" | "isSecureContext" | "origin" | "performance" | "sessionStorage" | "importScripts" | "ActiveXObject" | "WScript" | "WSH" | "Enumerator" | "VBArray" | "Map" | "WeakMap" | "Set" | "WeakSet" | "Iterator" | "Proxy" | "Reflect" | "Atomics" | "BigInt" | "BigInt64Array" | "BigUint64Array" | "AggregateError" | "WeakRef" | "FinalizationRegistry" | "SuppressedError" | "DisposableStack" | "AsyncDisposableStack" | "Float16Array") | "blob" | "file" | "formdata" | string;
|
|
105
284
|
/**
|
|
106
285
|
* 判断值是否为原生 Blob(含 File)。
|
|
107
286
|
*
|
|
@@ -342,6 +521,7 @@ declare function formatDurationMaxHour(totalSeconds: number, options?: Omit<Para
|
|
|
342
521
|
|
|
343
522
|
/**
|
|
344
523
|
* 通过动态创建 `<a>` 标签触发浏览器下载。
|
|
524
|
+
* 注意:此方法可能无法强制下载浏览器原生支持的文件(如图片、PDF),浏览器可能会选择直接打开。
|
|
345
525
|
*
|
|
346
526
|
* @param {string} url - 任意可下载地址(同源或允许跨域)
|
|
347
527
|
* @param {string} [fileName] - 保存到本地的文件名;不传时使用时间戳
|
|
@@ -377,6 +557,16 @@ declare function downloadExcel(data: string | ArrayBufferView | ArrayBuffer | Bl
|
|
|
377
557
|
* @param {string} [fileName] - 保存到本地的文件名
|
|
378
558
|
*/
|
|
379
559
|
declare function downloadJSON(data: any, fileName?: string): void;
|
|
560
|
+
/**
|
|
561
|
+
* 通过 `fetch` 获取资源并强制下载,避免浏览器直接打开文件。
|
|
562
|
+
* 此方法适用于下载图片、PDF 等浏览器默认会打开的文件类型。
|
|
563
|
+
* 如果 `fetch` 失败(如 CORS 策略阻止),会回退到 `downloadByUrl` 方法作为备选方案。
|
|
564
|
+
*
|
|
565
|
+
* @param {string} url - 文件的 URL 地址
|
|
566
|
+
* @param {string} [fileName] - 保存到本地的文件名。如果不提供,会尝试从 URL 中自动提取
|
|
567
|
+
* @returns {Promise<void>} 返回一个 Promise,在下载开始或失败后 resolve
|
|
568
|
+
*/
|
|
569
|
+
declare function fetchOrDownloadByUrl(url: string, fileName?: string): Promise<void>;
|
|
380
570
|
|
|
381
571
|
/**
|
|
382
572
|
* 简单、高性能的通用事件总线。
|
|
@@ -494,6 +684,22 @@ declare function flatCompleteTree2NestedTree<T>(nodes: T[], parentId?: number |
|
|
|
494
684
|
parentKey?: string | undefined;
|
|
495
685
|
childrenKey?: string | undefined;
|
|
496
686
|
}): (T & { [k in typeof childrenKey]: T[]; })[];
|
|
687
|
+
/**
|
|
688
|
+
* 从服务端返回的已选 id 数组里,提取出
|
|
689
|
+
* 1. 叶子节点
|
|
690
|
+
* 2. 所有子节点都被选中的父节点
|
|
691
|
+
* 其余父节点一律丢弃(由前端 Tree 自动算半选)
|
|
692
|
+
*
|
|
693
|
+
* @param {Array} treeData 完整树
|
|
694
|
+
* @param {Array} selectedKeys 后端给的选中 id 数组
|
|
695
|
+
* @param {String} idKey 节点唯一字段
|
|
696
|
+
* @param {String} childrenKey 子节点字段
|
|
697
|
+
* @returns {{checked: string[], halfChecked: string[]}}
|
|
698
|
+
*/
|
|
699
|
+
declare function extractFullyCheckedKeys(treeData: any[], selectedKeys: any[], idKey?: string, childrenKey?: string): {
|
|
700
|
+
checked: string[];
|
|
701
|
+
halfChecked: string[];
|
|
702
|
+
};
|
|
497
703
|
declare function findObjAttrValueById<T>(id: string | number, arr: T[], resultKey?: string, idKey?: string, childrenKey?: string): any;
|
|
498
704
|
|
|
499
|
-
export { IntervalTimer, MyEvent, MyEvent_CrossPagePlugin, MyId, assignExisting, calcTimeDifference, debounce, deepCloneByJSON, downloadByBlob, downloadByData, downloadByUrl, downloadExcel, downloadJSON, findObjAttrValueById, flatCompleteTree2NestedTree, formatDuration, formatDurationMaxDay, formatDurationMaxHour, getAllSearchParams, getDataType, getFunctionArgNames, getGUID, getSearchParam, getViewportSize, isBlob, isDate, isFunction, isNonEmptyString, isPlainObject, isPromise, moveItem, nestedTree2IdMap, randomDateInRange, randomEnLetter, randomHan, randomHanOrEn, randomIntInRange, readBlobAsText, shuffle, throttle, toDate };
|
|
705
|
+
export { AudioStreamResampler, IntervalTimer, MyEvent, MyEvent_CrossPagePlugin, MyId, WebSocketManager, assignExisting, calcTimeDifference, debounce, deepCloneByJSON, downloadByBlob, downloadByData, downloadByUrl, downloadExcel, downloadJSON, extractFullyCheckedKeys, fetchOrDownloadByUrl, findObjAttrValueById, flatCompleteTree2NestedTree, formatDuration, formatDurationMaxDay, formatDurationMaxHour, getAllSearchParams, getDataType, getFunctionArgNames, getGUID, getSearchParam, getViewportSize, isBlob, isDate, isFunction, isNonEmptyString, isPlainObject, isPromise, moveItem, nestedTree2IdMap, pcmToWavBlob, randomDateInRange, randomEnLetter, randomHan, randomHanOrEn, randomIntInRange, readBlobAsText, shuffle, throttle, toDate };
|
package/types/tree.d.ts
CHANGED
|
@@ -25,6 +25,22 @@ declare function flatCompleteTree2NestedTree<T>(nodes: T[], parentId?: number |
|
|
|
25
25
|
parentKey?: string | undefined;
|
|
26
26
|
childrenKey?: string | undefined;
|
|
27
27
|
}): (T & { [k in typeof childrenKey]: T[]; })[];
|
|
28
|
+
/**
|
|
29
|
+
* 从服务端返回的已选 id 数组里,提取出
|
|
30
|
+
* 1. 叶子节点
|
|
31
|
+
* 2. 所有子节点都被选中的父节点
|
|
32
|
+
* 其余父节点一律丢弃(由前端 Tree 自动算半选)
|
|
33
|
+
*
|
|
34
|
+
* @param {Array} treeData 完整树
|
|
35
|
+
* @param {Array} selectedKeys 后端给的选中 id 数组
|
|
36
|
+
* @param {String} idKey 节点唯一字段
|
|
37
|
+
* @param {String} childrenKey 子节点字段
|
|
38
|
+
* @returns {{checked: string[], halfChecked: string[]}}
|
|
39
|
+
*/
|
|
40
|
+
declare function extractFullyCheckedKeys(treeData: any[], selectedKeys: any[], idKey?: string, childrenKey?: string): {
|
|
41
|
+
checked: string[];
|
|
42
|
+
halfChecked: string[];
|
|
43
|
+
};
|
|
28
44
|
declare function findObjAttrValueById<T>(id: string | number, arr: T[], resultKey?: string, idKey?: string, childrenKey?: string): any;
|
|
29
45
|
|
|
30
|
-
export { findObjAttrValueById, flatCompleteTree2NestedTree, nestedTree2IdMap };
|
|
46
|
+
export { extractFullyCheckedKeys, findObjAttrValueById, flatCompleteTree2NestedTree, nestedTree2IdMap };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @class WebSocketManager - 一个纯粹、强大的 WebSocket 连接管理引擎
|
|
3
|
+
*
|
|
4
|
+
* @features
|
|
5
|
+
* - 智能断线重连 (指数退避算法)
|
|
6
|
+
* - 网络状态监听
|
|
7
|
+
* - 高度可定制的心跳保活机制 (通过注入函数实现)
|
|
8
|
+
* - 页面可见性 API 集成
|
|
9
|
+
* - 消息发送队列
|
|
10
|
+
* - 清晰的生命周期管理
|
|
11
|
+
* - 优雅的资源销毁
|
|
12
|
+
* - 可配置的数据序列化/反序列化
|
|
13
|
+
* - 纯粹的消息传递,不关心消息内容
|
|
14
|
+
*/
|
|
15
|
+
declare class WebSocketManager {
|
|
16
|
+
/**
|
|
17
|
+
* @param {string} url - WebSocket 服务器的地址
|
|
18
|
+
* @param {object} [options={}] - 配置选项
|
|
19
|
+
* @param {number} [options.heartbeatInterval=30000] - 心跳间隔 (毫秒)
|
|
20
|
+
* @param {number} [options.heartbeatTimeout=10000] - 心跳超时时间 (毫秒)
|
|
21
|
+
* @param {number} [options.reconnectBaseInterval=1000] - 重连基础间隔 (毫秒)
|
|
22
|
+
* @param {number} [options.maxReconnectInterval=30000] - 最大重连间隔 (毫秒)
|
|
23
|
+
* @param {number} [options.maxReconnectAttempts=Infinity] - 最大重连次数
|
|
24
|
+
* @param {boolean} [options.autoConnect=true] - 是否在实例化后自动连接
|
|
25
|
+
* @param {boolean} [options.serializeData=false] - 发送数据时是否自动序列化为JSON字符串
|
|
26
|
+
* @param {boolean} [options.deserializeData=false] - 接收数据时是否自动反序列化为JSON对象
|
|
27
|
+
* @param {function|null} [options.getPingMessage=null] - 返回要发送的 ping 消息内容的函数。如果为 null,则不发送心跳。
|
|
28
|
+
* @param {function|null} [options.isPongMessage=null] - 判断接收到的消息是否为 pong 的函数。接收 MessageEvent 对象作为参数,返回布尔值。
|
|
29
|
+
* @param {object} [options.protocols] - WebSocket 协议
|
|
30
|
+
*/
|
|
31
|
+
constructor(url: string, options?: {
|
|
32
|
+
heartbeatInterval?: number | undefined;
|
|
33
|
+
heartbeatTimeout?: number | undefined;
|
|
34
|
+
reconnectBaseInterval?: number | undefined;
|
|
35
|
+
maxReconnectInterval?: number | undefined;
|
|
36
|
+
maxReconnectAttempts?: number | undefined;
|
|
37
|
+
autoConnect?: boolean | undefined;
|
|
38
|
+
serializeData?: boolean | undefined;
|
|
39
|
+
deserializeData?: boolean | undefined;
|
|
40
|
+
getPingMessage?: Function | null | undefined;
|
|
41
|
+
isPongMessage?: Function | null | undefined;
|
|
42
|
+
protocols?: object | undefined;
|
|
43
|
+
});
|
|
44
|
+
url: string;
|
|
45
|
+
options: {
|
|
46
|
+
heartbeatInterval: number;
|
|
47
|
+
heartbeatTimeout: number;
|
|
48
|
+
reconnectBaseInterval: number;
|
|
49
|
+
maxReconnectInterval: number;
|
|
50
|
+
maxReconnectAttempts: number;
|
|
51
|
+
autoConnect: boolean;
|
|
52
|
+
serializeData: boolean;
|
|
53
|
+
deserializeData: boolean;
|
|
54
|
+
getPingMessage: Function | null;
|
|
55
|
+
isPongMessage: Function | null;
|
|
56
|
+
protocols?: object | undefined;
|
|
57
|
+
};
|
|
58
|
+
ws: WebSocket | null;
|
|
59
|
+
readyState: 3;
|
|
60
|
+
reconnectAttempts: number;
|
|
61
|
+
forcedClose: boolean;
|
|
62
|
+
isReconnecting: boolean;
|
|
63
|
+
heartbeatTimer: number | null;
|
|
64
|
+
heartbeatTimeoutTimer: number | null;
|
|
65
|
+
reconnectTimer: number | null;
|
|
66
|
+
messageQueue: any[];
|
|
67
|
+
listeners: Map<any, any>;
|
|
68
|
+
_onOpen(event: any): void;
|
|
69
|
+
/**
|
|
70
|
+
* 纯粹的消息处理方法:处理心跳,然后将数据交给使用者
|
|
71
|
+
* @param {MessageEvent} event
|
|
72
|
+
*/
|
|
73
|
+
_onMessage(event: MessageEvent): void;
|
|
74
|
+
_onClose(event: any): void;
|
|
75
|
+
_onError(event: any): void;
|
|
76
|
+
_handleVisibilityChange(): void;
|
|
77
|
+
_handleOnline(): void;
|
|
78
|
+
_handleOffline(): void;
|
|
79
|
+
/**
|
|
80
|
+
* 连接到 WebSocket 服务器
|
|
81
|
+
*/
|
|
82
|
+
connect(): void;
|
|
83
|
+
/**
|
|
84
|
+
* 发送数据
|
|
85
|
+
* @param {string|object|ArrayBuffer|Blob} data - 要发送的数据
|
|
86
|
+
*/
|
|
87
|
+
send(data: string | object | ArrayBuffer | Blob): void;
|
|
88
|
+
/**
|
|
89
|
+
* 主动关闭连接
|
|
90
|
+
* @param {number} [code=1000] - 关闭代码
|
|
91
|
+
* @param {string} [reason=''] - 关闭原因
|
|
92
|
+
*/
|
|
93
|
+
close(code?: number, reason?: string): void;
|
|
94
|
+
/**
|
|
95
|
+
* 彻底销毁实例,清理所有资源
|
|
96
|
+
*/
|
|
97
|
+
destroy(): void;
|
|
98
|
+
/**
|
|
99
|
+
* 添加事件监听器
|
|
100
|
+
* @param {string} eventName - 事件名 (e.g., 'open', 'message', 'close', 'error', 'reconnect')
|
|
101
|
+
* @param {function} callback - 回调函数
|
|
102
|
+
*/
|
|
103
|
+
on(eventName: string, callback: Function): void;
|
|
104
|
+
/**
|
|
105
|
+
* 移除事件监听器
|
|
106
|
+
* @param {string} eventName - 事件名
|
|
107
|
+
* @param {function} callback - 回调函数
|
|
108
|
+
*/
|
|
109
|
+
off(eventName: string, callback: Function): void;
|
|
110
|
+
_startHeartbeat(): void;
|
|
111
|
+
_stopHeartbeat(): void;
|
|
112
|
+
_setHeartbeatTimeout(): void;
|
|
113
|
+
_clearHeartbeatTimeout(): void;
|
|
114
|
+
_handlePong(): void;
|
|
115
|
+
_scheduleReconnect(): void;
|
|
116
|
+
_clearReconnectTimer(): void;
|
|
117
|
+
_flushMessageQueue(): void;
|
|
118
|
+
_emit(eventName: any, ...args: any[]): void;
|
|
119
|
+
_updateReadyState(newState: any): void;
|
|
120
|
+
_setupEventListeners(): void;
|
|
121
|
+
_removeEventListeners(): void;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export { WebSocketManager };
|