mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-27 02:01:15 +08:00
105d79b0d9
* refactor: extract isClient and isNumber isBoolean * test: update test * refactor: extract isClient to browser
10 lines
287 B
TypeScript
10 lines
287 B
TypeScript
import { isClient } from './browser'
|
|
|
|
export const rAF = (fn: () => void) =>
|
|
isClient
|
|
? window.requestAnimationFrame(fn)
|
|
: (setTimeout(fn, 16) as unknown as number)
|
|
|
|
export const cAF = (handle: number) =>
|
|
isClient ? window.cancelAnimationFrame(handle) : clearTimeout(handle)
|