w3c / compute-pressure

A web API proposal that provides information about available compute capacity
https://www.w3.org/TR/compute-pressure/
Other
69 stars 10 forks source link

observe()'s runs too many steps in parallel #152

Closed rakuco closed 2 years ago

rakuco commented 2 years ago

The current steps for PressureObserver.observe() essentially create a promise, run everything else in an "in parallel" block and return the promise.

This is not entirely spec-compliant though, as per https://html.spec.whatwg.org/multipage/webappapis.html#event-loop-for-spec-authors reaching into gloabals or settings objects is against the idea of running steps in parallel.

The same section has some examples of what can be done, and https://w3c.github.io/screen-wake-lock/#the-request-method should be a good example too.

rakuco commented 2 years ago

@arskama @kenchris @wangw-1991

kenchris commented 2 years ago

So I guess accessing the document is fine (it is not manipulating) but that can also be done before, but the last steps manipulate the global and should not be done