mirror of
https://github.com/chrononeko/chronocat.git
synced 2024-11-25 18:03:40 +00:00
fix(api): groupNotify.refresh()
adapt delay-debounce
This commit is contained in:
parent
1edea8a220
commit
1228b3f17d
@ -1,13 +1,7 @@
|
|||||||
|
import { debounce } from 'lodash-es'
|
||||||
import { getSingleScreenNotifies } from '../definitions/groupService'
|
import { getSingleScreenNotifies } from '../definitions/groupService'
|
||||||
|
|
||||||
let t = new Date().getTime()
|
const refreshIntl2 = async () => {
|
||||||
|
|
||||||
const refresh = async () => {
|
|
||||||
const nt = new Date().getTime()
|
|
||||||
|
|
||||||
if (nt - t < 10000) return
|
|
||||||
t = nt
|
|
||||||
|
|
||||||
void getSingleScreenNotifies({
|
void getSingleScreenNotifies({
|
||||||
doubt: false,
|
doubt: false,
|
||||||
startSeq: '',
|
startSeq: '',
|
||||||
@ -20,6 +14,12 @@ const refresh = async () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const refreshIntl1 = debounce(refreshIntl2, 2000, {
|
||||||
|
maxWait: 2000,
|
||||||
|
})
|
||||||
|
|
||||||
|
const refresh = () => setTimeout(refreshIntl1, 2000)
|
||||||
|
|
||||||
export const groupNotify = {
|
export const groupNotify = {
|
||||||
refresh,
|
refresh,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user