-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Cases #16
Comments
Thanks for the suggestions, I agree that we should add those things. One of the main use cases we're targeting with
A couple important bits here are the yielding and scheduling of the macrotask. Apps and frameworks want to yield to keep the page responsive (input and rendering) and also not starve out other high priority work, e.g. I/O.
Of course other non-userspace script can use this API ( It's also worth noting that we're considering exposing the priorities to async APIs like I'll work on adding use cases and example code to better illustrate these benefits in practice. |
@shaseley thank you for the response. I'm still not sure I understand entirely. I think a lot of these things you mentioned here (all of them?) have ad-hoc solutions (like isInputPending, requestPostAnimationFrame etc). I am looking in particular for either:
To be clear, I am not objecting to this API in either of these three cases. I think this sort of API makes sense for the web platform anyway and I've found it incredibly useful in platforms that had it (like asp.net webapi servers). This sort of API (and controller) would also enable things like "schedule things off request stories" and actually can help quite a bit with seemingly unrelated things because it binds the tasks to a context (so for example the platform could use this for debugging info, context and scope). |
Hi, @benjamingr, apologies for the lag.
I don't think it's an either or here, but maybe a little (arguably) from (a), and a good deal from (b) and (c). The API exposes three priorities that are used for two purposes:
And it provides one guarantee: that user-blocking tasks run before user-visible tasks, which in turn run before background tasks. There are no ordering guarantees between
'user-blocking' priority is probably the closest thing to a (performance) capability. To elaborate, you’re right that much of
For 'user-blocking' tasks, to get the same ordering guarantees as
There are also plans for building features on top of postTask which might be considered capabilities.
I think both of these are important and are goals of the API. I'll acknowledge that the API is very polyfillable, but that performance characteristics will likely vary because of no direct mapping for 'user-blocking' (something we're trying to determine in testing / origin trial).
|
Hey,
I'm trying to figure out what use cases this API is good for. It looks pretty cool and I recently saw it's implemented in Chrome (also cool).
The README mentions a complicated use case of main thread contention like a "search as you type" but I'm not sure I grok why this API would address this.
I know there is a TODO there to add an entire document of use cases - but I think it would go a long way (motivationally) to just upload an example of:
The text was updated successfully, but these errors were encountered: