Editorial: expose "run steps after a timeout"#7349
Merged
Conversation
This was referenced Nov 19, 2021
annevk
reviewed
Nov 22, 2021
This factors out a new algorithm which can be used by postTask() (https://wicg.github.io/scheduling-apis/#schedule-a-posttask-task) and AbortSignal.timeout() (whatwg/dom#1032), ensuring that they correctly contribute to idle deadline computation and in general share all the appropriate logic with setTimeout() and setInterval(). This also exports the "timer task source" term since AbortSignal.abort() will want to use that.
0bdf95e to
6949e88
Compare
| than zero that will identify the timeout to be set by this call in <var>global</var>'s <span>map | ||
| of active timers</span>.</p></li> | ||
| than zero and does not already <span data-x="map exists">exist</span> in <var>global</var>'s | ||
| <span>map of active timers</span>.</p></li> |
Member
There was a problem hiding this comment.
This implies that a now-cleared ID can be reused, even if less than 2^31 timers have been created so far. But this is probably best left for #7358.
annevk
approved these changes
Nov 24, 2021
|
|
||
| <p>Otherwise, <var>global</var> is a <code>WorkerGlobalScope</code> object; wait until | ||
| <var>milliseconds</var> milliseconds have passed with the worker not suspended (not | ||
| necessarily consecutively).</p> |
Member
There was a problem hiding this comment.
Should this xref "active needed worker"?
Member
Author
There was a problem hiding this comment.
The interaction with the closing flag in https://html.spec.whatwg.org/#worker-processing-model:suspendable-worker makes me not 100% sure they are equivalent, so I'll leave it for now...
andreubotella
pushed a commit
to andreubotella/requestidlecallback
that referenced
this pull request
Dec 2, 2021
In whatwg/html#7349, the HTML spec factored out part of the infrastructure for `setTimeout()` into a "run steps after a timeout" algorithm for use by other specs. This change updates `requestIdleCallback()` to use that algorithm when the `timeout` property is present and positive.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This factors out a new algorithm which can be used by postTask() (https://wicg.github.io/scheduling-apis/#schedule-a-posttask-task) and AbortSignal.timeout() (whatwg/dom#1032), ensuring that they correctly contribute to idle deadline computation and in general share all the appropriate logic with setTimeout() and setInterval().
This also exports the "timer task source" term since AbortSignal.abort() will want to use that.
/timers-and-user-prompts.html ( diff )
/webappapis.html ( diff )