mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 01:41:20 +08:00
12 lines
327 B
TypeScript
12 lines
327 B
TypeScript
import { isClient } from '@vueuse/core'
|
|
|
|
let rAF = (fn: () => void) => setTimeout(fn, 16) as unknown as number
|
|
let cAF = (handle: number) => clearTimeout(handle)
|
|
|
|
if (isClient) {
|
|
rAF = (fn: () => void) => window.requestAnimationFrame(fn)
|
|
cAF = (handle: number) => window.cancelAnimationFrame(handle)
|
|
}
|
|
|
|
export { rAF, cAF }
|