mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 09:12:52 +00:00
12 lines
341 B
JavaScript
12 lines
341 B
JavaScript
// note the function should be of low priority
|
|
// and should not be returning a value.
|
|
export function utilCallWhenIdle(func, timeout) {
|
|
return function() {
|
|
var args = arguments;
|
|
var that = this;
|
|
window.requestIdleCallback(function() {
|
|
func.apply(that, args);
|
|
}, {timeout: timeout});
|
|
};
|
|
}
|