初步实现消息通知功能
This commit is contained in:
@@ -78,6 +78,14 @@ export function onConnect(handler) {
|
||||
return () => s.off('connect', handler);
|
||||
}
|
||||
|
||||
export function sendEvent(type, content = null) {
|
||||
const s = getSocket();
|
||||
s.emit('send-event', {
|
||||
type,
|
||||
content
|
||||
});
|
||||
}
|
||||
|
||||
export function disconnect() {
|
||||
if (!socket) return;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user