8 lines
177 B
TypeScript
Raw Normal View History

2019-11-18 02:04:13 +00:00
export default function requestIdleCallback(func: Function) {
2018-04-02 05:34:16 +00:00
if("requestIdleCallback" in window) {
2018-10-11 03:09:12 +00:00
(window["requestIdleCallback"] as Function)(func)
2018-04-02 05:34:16 +00:00
} else {
func()
}
2019-11-17 09:44:30 +00:00
}