replaced call socket() with apiOn/apiOff

This commit is contained in:
Jan Prochazka
2021-12-22 11:24:48 +01:00
parent 05ea435820
commit 2ace0bdb34
13 changed files with 41 additions and 46 deletions

View File

@@ -1,10 +1,9 @@
<script lang="ts">
import _ from 'lodash';
import ErrorInfo from '../elements/ErrorInfo.svelte';
import { apiOff, apiOn } from '../utility/api';
import createRef from '../utility/createRef';
import socket from '../utility/socket';
import useEffect from '../utility/useEffect';
import MessageView from './MessageView.svelte';
@@ -30,9 +29,9 @@
$: effect = useEffect(() => {
if (eventName) {
socket().on(eventName, handleInfo);
apiOn(eventName, handleInfo);
return () => {
socket().off(eventName, handleInfo);
apiOff(eventName, handleInfo);
};
}
return () => {};