change chats to use custom makeFetcher

This commit is contained in:
Shpuld Shpuldson 2020-09-02 21:01:31 +03:00
commit 1b6eee0497
4 changed files with 10 additions and 11 deletions

View file

@ -6,7 +6,6 @@ export const makeFetcher = (call, interval) => {
func = () => {
call().finally(() => {
console.log('callbacks')
if (stopped) return
timeout = window.setTimeout(func, interval)
})
@ -14,7 +13,7 @@ export const makeFetcher = (call, interval) => {
const stopFetcher = () => {
stopped = true
window.cancelTimeout(timeout)
window.clearTimeout(timeout)
}
func()