mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
* fix: bilibili comment theme color * cleanup * fix: spinner bg color * refactor: adjust theme color timer logic * fix: comment tags still show a light color when page is first loaded * chore: remove unused import in useDark.ts --------- Co-authored-by: Hakadao <a578457889743@gmail.com>
15 lines
345 B
TypeScript
15 lines
345 B
TypeScript
export function executeTimes(fn: () => void | Promise<void>, times: number, interval: number = 1000) {
|
|
let count = 0
|
|
let timer: NodeJS.Timeout
|
|
// eslint-disable-next-line prefer-const
|
|
timer = setInterval(async () => {
|
|
await fn()
|
|
count++
|
|
if (count >= times) {
|
|
clearInterval(timer)
|
|
}
|
|
}, interval)
|
|
|
|
return timer
|
|
}
|