Skip to content
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

Add a sensors feature #2299

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add a sensors feature #2299

wants to merge 2 commits into from

Conversation

Elchi3
Copy link
Collaborator

@Elchi3 Elchi3 commented Nov 21, 2024

See https://developer.mozilla.org/en-US/docs/Web/API/Sensor_APIs

Specific sensors:

@github-actions github-actions bot added the feature definition Creating or defining new features or groups of features. label Nov 21, 2024
@Elchi3 Elchi3 mentioned this pull request Nov 21, 2024
@autonome
Copy link
Collaborator

@Elchi3 Is this usable in the absence of a specific sensor? Review feedback on "base class" types of features so far has been to bundle them w/ the first usable implementation.

@Elchi3
Copy link
Collaborator Author

Elchi3 commented Nov 27, 2024

hm, what is the first usable implementation or specific sensor here? Looks like there is varying support and even re-implementations on top of "generic sensors" (this API).

@captainbrosset
Copy link
Contributor

Yeah, I don't think we should create a feature just with those keys, because they don't represent a thing developers can use. This is an interesting case where we'd almost need these BCD keys to be duplicated into each of the features that use Sensor as a base class.

Why don't we allow duplication of BCD keys by the way? @ddbeck?

BCD keys:

  • api.Sensor
  • api.Sensor.activate_event
  • api.Sensor.activated
  • api.Sensor.error_event
  • api.Sensor.hasReading
  • api.Sensor.reading_event
  • api.Sensor.start
  • api.Sensor.stop
  • api.Sensor.timestamp
  • api.SensorErrorEvent
  • api.SensorErrorEvent.SensorErrorEvent
  • api.SensorErrorEvent.error

Classes that inherit from Sensor

@captainbrosset
Copy link
Contributor

We just discussed about this PR on the WebDX CG call (minutes).

The options seem to be the following:

  • Ignore the generic Sensor BCD keys (at least for now).
  • Bundle these keys with whichever feature came first, as suggested by Dietrich.
  • Duplicate the keys among all of the features that derive from the generic Sensor class.
  • Create a generic Sensor feature.

I don't want to block this PR, but I do want to express my opinion, which is that we should either ignore the keys for now, or fold them under one of the concrete sensor classes (not sure which one). If people feel strongly that we need a Sensor feature, then I won't block the PR either.

I'm having trouble seeing the value of creating a standalone generic Sensor feature in this repo. This repo is used to generate summarized browser support data for features that web developers want to use.
If a dev wants to use the AmbientLightSensor to implement a use case in their app, then we should have a feature for it, which gives them the right browser data.
Can developers use the Sensor class on its own? I don't think so. Do they think about the Sensor class separately from the rest? Maybe, not sure. We should maybe do some customer research here.

Now, during the meeting, the learning argument was brought forward. That a dev would have to learn about the Sensor interface anyway, because that's what gives them at least half of the methods/events that they'll end up using. My counter argument here is that I don't think web-features needs to care about that too much. Web-features cares about "entry points", about the features that are in devs' minds. Web-features answers questions like "Is there a feature to detect light?", "Where is that feature supported?"

@ddbeck
Copy link
Collaborator

ddbeck commented Nov 29, 2024

Why don't we allow duplication of BCD keys by the way? @ddbeck?

This came at MDN's request, when feature authoring was considerably less sophisticated. It was (and is) ambiguous where an MDN page's status ought to come from, if the compat key can be in multiple features. I'm going to ask the MDN folks soon about their current perspective on this.

Duplicate the keys among all of the features that derive from the generic Sensor class

I agree that this is the long-term correct answer. AFAICT, you can't do anything useful with the Sensor API without a concrete physical sensor (or virtual sensor, in the case of webdriver) and its attendant interface additions.

In the mean time…

Bundle these keys with whichever feature came first, as suggested by Dietrich

I think this is the correct way forward, if it's possible. The process would look like this: compare all the concrete sensor implementations and find the least common denominator (i.e., the sensor that is oldest and mostly widely implemented).

I could imagine cases where this wouldn't work very cleanly (e.g., if the most widely implemented sensor is not the oldest). In that case, I'd say we ought to set aside these keys and work to resolve #1173 quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature definition Creating or defining new features or groups of features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants