Are functions passed to requestIdleCallback
guaranteed to run when no timeout
is specified? (Assuming we aren't in some contrived scenario, specifically engineered to avoid idle state indefinitiely)
And if a timeout
is specified, is there a guarantee around order of execution? e.g.
const options = { timeout: 10000 };
requestIdleCallback(fnOne, options);
requestIdleCallback(fnTwo, options);
requestIdleCallback(fnThree, options);
Are fnOne
, fnTwo
, and fnThree
guaranteed to be invoke in that order every time?
Cooperative Scheduling of Background Tasks says:
Therefore, I believe with your example,
fnOne
,fnTwo
andfnThree
would be executed in that order.