feat(websocket): add backward compatible aliases for dict and online count composables

This commit is contained in:
Ray.Hao
2025-11-10 07:58:32 +08:00
parent ff00e82f56
commit 05e3d1210a
2 changed files with 14 additions and 0 deletions

View File

@@ -12,6 +12,11 @@ export interface DictChangeMessage {
timestamp: number;
}
/**
* 字典消息别名(向后兼容)
*/
export type DictMessage = DictChangeMessage;
/**
* 字典变更事件回调函数类型
*/
@@ -158,6 +163,11 @@ function createDictSyncComposable() {
cleanup,
onDictChange,
// 别名方法(向后兼容)
initWebSocket: initialize,
closeWebSocket: cleanup,
onDictMessage: onDictChange,
// 用于测试和调试
handleDictChangeMessage,
};

View File

@@ -160,6 +160,10 @@ function createOnlineCountComposable() {
// 方法
initialize,
cleanup,
// 别名方法(向后兼容)
initWebSocket: initialize,
closeWebSocket: cleanup,
};
}