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

Move options to observe() #261

Closed kenchris closed 6 months ago

kenchris commented 6 months ago

Fixes #259


Preview | Diff

arskama commented 6 months ago

LGTM, Would be good to have another reviewer on that one as well.

kenchris commented 6 months ago

@tomayac Arnaud has another PR up for changing the explainer etc.

If it is 0, it will get as fast as the system can handle:

If timeDeltaMilliseconds ≥ sampleInterval, return true, otherwise return false.

We could consider using something else, mind filing an issue?

darktears commented 6 months ago

LGTM.

kenchris commented 6 months ago

https://wicg.github.io/periodic-background-sync/#periodic-sync-registration-minimum-interval <- also uses minInterval of 0 (as fast as system allows)

https://wicg.github.io/js-self-profiling/#the-profilersample-dictionary says it must be 0 or bigger, but doesn't even check whether it is not undefined

kenchris commented 6 months ago

Yes, for the same source type that makes sense, but we need to spec things differently when we support multiple sources. We do support two sources now in the spec, but makes sense to postpone this change till after shipping, to not give @arskama unneeded work as this is purely a spec change for now.

PerformanceObserver works the same way. A consecutive call to observe is seen as an update, and in the case some update is incompatible (like moving from one type to multiple) which is not a problem for us, then they throw "InvalidModificationError".

Anyway, here is a PR we can merge when we decide to https://github.com/w3c/compute-pressure/pull/263