- From: Florian Scholz via GitHub <sysbot+gh@w3.org>
- Date: Mon, 08 Apr 2024 10:03:36 +0000
- To: public-device-apis-log@w3.org
I think the reason for `PerformanceObserve` to have both `type` and `entryTypes` is that there are rules about how this plays together with other properties of the options object:
```js
// valid
observe({ type: "resource", buffered: true });
observe({ type: "event", durationThreshold: 160 });
observe({ entryTypes: ["mark", "measure"] });
// invalid
observe({ entryTypes: ["resource"], buffered: true });
observe({ entryTypes: ["event", "mark"], durationThreshold: 160 });
observe({ entryTypes: ["resource"], type: "event" });
```
So in PressureObserver, you need to decide if you want to allow `sampleInterval` to be set for all sources or not, for example, and what would be the deal with source-specific options:
```js
await observer.observe({ sources: ["cpu", "gpu"], sampleInterval: 2500 }); / valid?
await observer.observe({ source: "cpu", sampleInterval: 2500 }); // valid
await observer.observe({ sources: ["cpu", "gpu"], gpuSpecificOption: "foo" }); // invalid?
await observer.observe({ source: "gpu", gpuSpecificOption: "foo" }); // valid
```
> Or does @Elchi3 believe we should just support `sources` and not `source`?
I think I would say having both makes sense. Especially, if you believe there will be source-specific options.
--
GitHub Notification of comment by Elchi3
Please view or discuss this issue at https://github.com/w3c/compute-pressure/issues/262#issuecomment-2042350123 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 8 April 2024 10:03:36 UTC