Interfaces, factory functions, and data

It would be useful for us to consider, when thinking about data structures for information about APIs, that it would be useful to be able to back-reference from an interface to the methods in other interfaces that create them.

For example, it would be useful if an object describing the capabilities of the XRSession interface include a reference to the XR.requestSession() method, which is how you get access to session objects.

If I were to add this to our current data system, I’d lobby to add it to InterfaceData.json:

"XRSession": {
  "inh": "EventTarget",
  "impl": [],
  "factories": ["XR.requestSession()"]

In fact, I’d probably go one farther and also add a constructors property. If it’s not present, a object has no constructors. Otherwise, it’s one or more methods in the interface which serve as constructors.

1 Like

I’d rather we do this using mdn‑data, after mdn/sprints#1694.

I’d like to at least get mdn/data#358 merged.

Yes, I meant whichever source we use for that inheritance and implements data. Since we’re currently still using InterfaceData.json, that’s just the one I mentioned outright. I should have been more clear.

1 Like