On Thu, May 18, 2017, at 10:10 AM, L. David Baron wrote: > On Thursday 2017-05-18 11:22 +1000, Mark Hammond wrote: > > I'm wondering if there are any ideas about how to solve this optimally? > > Naively, it seems that the (broadest sense of the term) "platform" might be > > able to help here using it's knowledge of the event-loop state - eg, a > > function that indicates "are we about to starve the event loop and become > > janky?", or possibly even the whole hog (ie, "please yield to the event loop > > if you think now is a good time, otherwise just hand back a pre-resolved > > promise"). > > One other option would be to use time rather than iterations as a > measure of when to return. > > A platform API that's somewhat like this is requestIdleCallback, > whose spec is at https://w3c.github.io/requestidlecallback/ -- in > particular, the timeRemaining() method on the IdleDeadline object > passed to the callback. See also: > https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback > https://developer.mozilla.org/en-US/docs/Web/API/Background_Tasks_API > > I'm not sure whether it works for privileged (chrome) JS, but it > seems like it ought to...
The non-DOM version of rIC is being tracked by https://bugzilla.mozilla.org/show_bug.cgi?id=1353206 and https://bugzilla.mozilla.org/show_bug.cgi?id=1358476 Kanru _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform