UNPKG

uni-ui-plus

Version:

🦄基于uni-ui的二次封装的uniapp组件库

23 lines (18 loc) 576 B
const _window = globalThis as any export const inBrowser = typeof globalThis !== 'undefined' function requestAniFrame() { return _window === undefined ? function (callback: () => void) { setTimeout(callback, 1000 / 60) } : _window.requestAnimationFrame || _window.webkitRequestAnimationFrame || function (callback: () => void) { _window.setTimeout(callback, 1000 / 60) } } export function cancelRaf(id: number) { if (inBrowser) cancelAnimationFrame(id) else clearTimeout(id) } export default requestAniFrame()