mirror of
https://github.com/chrononeko/chronocat.git
synced 2024-11-22 07:07:53 +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'
|
||||
|
||||
let t = new Date().getTime()
|
||||
|
||||
const refresh = async () => {
|
||||
const nt = new Date().getTime()
|
||||
|
||||
if (nt - t < 10000) return
|
||||
t = nt
|
||||
|
||||
const refreshIntl2 = async () => {
|
||||
void getSingleScreenNotifies({
|
||||
doubt: false,
|
||||
startSeq: '',
|
||||
@ -20,6 +14,12 @@ const refresh = async () => {
|
||||
})
|
||||
}
|
||||
|
||||
const refreshIntl1 = debounce(refreshIntl2, 2000, {
|
||||
maxWait: 2000,
|
||||
})
|
||||
|
||||
const refresh = () => setTimeout(refreshIntl1, 2000)
|
||||
|
||||
export const groupNotify = {
|
||||
refresh,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user