销毁channel

This commit is contained in:
yj 2024-10-18 16:16:23 +08:00
parent 3423e13487
commit 70dc2321a0
7 changed files with 15 additions and 0 deletions

View File

@ -51,6 +51,9 @@ const ChatBigWindow: React.FC = () => {
msg: '', msg: '',
} }
}); });
return () => {
channel.close();
}
}, []); }, []);
return ( return (

View File

@ -27,6 +27,9 @@ const ChatSmallWindow: React.FC = () => {
break; break;
} }
} }
return () => {
channel.close();
}
}, []); }, []);
const removeItemByIndex = () => { const removeItemByIndex = () => {
setChatLists((res: any) => { setChatLists((res: any) => {

View File

@ -16,6 +16,9 @@ const CurrentSpeakUserWindow: React.FC = () => {
break; break;
} }
} }
return () => {
channel.close();
}
}, []); }, []);

View File

@ -88,6 +88,7 @@ const NoticeWindow: React.FC = () => {
}, 4000); }, 4000);
return () => { return () => {
clearInterval(time) clearInterval(time)
channel.close();
}; };
}, []) }, [])
return ( return (

View File

@ -90,6 +90,7 @@ const ShareScreenWindow: React.FC = () => {
}); });
return () => { return () => {
clearInterval(timeout) clearInterval(timeout)
channel.close();
}; };
}, []); }, []);
const changeCurrentSeconds = (time: number): string => { const changeCurrentSeconds = (time: number): string => {

View File

@ -33,6 +33,9 @@ const UserListWindow: React.FC = () => {
channel.postMessage({ channel.postMessage({
type: 'userListWindowGetRoomUserList' type: 'userListWindowGetRoomUserList'
}); });
return () => {
channel.close();
}
}, []); }, []);
return ( return (
<> <>

View File

@ -431,6 +431,7 @@ const Meeting: React.FC = () => {
window.removeEventListener('customStorageChange', handleCustomStorageChange); window.removeEventListener('customStorageChange', handleCustomStorageChange);
window.removeEventListener('wheel', handleWheelChange); window.removeEventListener('wheel', handleWheelChange);
clearInterval(time) clearInterval(time)
channel.close();
}; };
}, []); }, []);