mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-27 03:01:14 +08:00
15 lines
327 B
TypeScript
15 lines
327 B
TypeScript
import isServer from './isServer'
|
|
|
|
let rAF = (fn: () => void) => setTimeout(fn, 16) as unknown as number
|
|
let cAF = (handle: number) => clearTimeout(handle)
|
|
|
|
if (!isServer) {
|
|
rAF = (fn: () => void) => window.requestAnimationFrame(fn)
|
|
cAF = (handle: number) => window.cancelAnimationFrame(handle)
|
|
}
|
|
|
|
export {
|
|
rAF,
|
|
cAF,
|
|
}
|