recursal/MDN huggingface dataset:
RTCPeerConnectionStats
======================

The **`RTCPeerConnectionStats`** dictionary of the WebRTC API provides information about the high level peer connection (`RTCPeerConnection`).

 In particular, it provides the number of unique data channels that have been opened, and the number of opened channels that have been closed.
 This allows the current number of open channels to be calculated.

These statistics can be obtained by iterating the `RTCStatsReport` returned by `RTCPeerConnection.getStats()` until you find a report with the `type` of `peer-connection`.

Instance properties
-------------------

`dataChannelsOpened`

A positive integer value indicating the number of unique `RTCDataChannel` objects that have entered the `open` state during their lifetime.

`dataChannelsClosed`

 A positive integer value indicating the number of unique `RTCDataChannel` objects that have left the `open` state during their lifetime (channels that transition to `closing` or `closed` without ever being `open` are not counted in this number).
 A channel will leave the `open` state if either end of the connection or the underlying transport is closed.


### Common instance properties

The following properties are common to all WebRTC statistics objects.

`id`

A string that uniquely identifies the object that is being monitored to produce this set of statistics.

`timestamp`

A `DOMHighResTimeStamp` object indicating the time at which the sample was taken for this statistics object.

`type`

A string with the value `"peer-connection"`, indicating the type of statistics that the object contains.

Examples
--------

 This example shows a function to return the total number of open connections, or `null` if no statistics are provided.
 This might be called in a loop, similar to the approach used in `RTCPeerConnection.getStats()` example

 The function waits for the result of a call to `RTCPeerConnection.getStats()` and then iterates the returned `RTCStatsReport` to get just the stats of type `"peer-connection"`.
 It then returns the total number of open channels, or `null`, using the data in the report.


```js
async function numberOpenConnections (peerConnection) {
  const stats = await peerConnection.getStats();
  let peerConnectionStats = null;

  stats.forEach((report) => {
    if (report.type === "peer-connection") {
      peerConnectionStats = report;
      break;
    }
  });

result = (typeof peerConnectionStats.dataChannelsOpened === 'undefined' || typeof peerConnectionStats.dataChannelsClosed=== 'undefined') ? null : peerConnectionStats.dataChannelsOpened - peerConnectionStats.dataChannelsClosed;
return result
}
```

Specifications
--------------

| Specification |
| --- |
| Identifiers for WebRTC's Statistics API # dom-rtcstatstype-peer-connection |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
PresentationConnectionAvailableEvent
====================================

**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

**Secure context:** This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The **`PresentationConnectionAvailableEvent`** interface of the Presentation API is fired on a `PresentationRequest` when a connection associated with the object is created.

A controlling user agent fires a trusted event named `connectionavailable` on a `PresentationRequest` when a connection associated with the object is created. It is fired at the `PresentationRequest` instance, using the `PresentationConnectionAvailableEvent` interface, with the `connection` attribute set to the `PresentationConnection` object that was created. The event is fired for each connection that is created for the controller, either by the controller calling `start()` or `reconnect()`, or by the controlling user agent creating a connection on the controller's behalf via `defaultRequest`.

Event

PresentationConnectionAvailableEventConstructor
-----------

`PresentationConnectionAvailableEvent()` 
Experimental

Creates a new PresentationConnectionAvailableEvent.

Instance properties
-------------------

`PresentationConnectionAvailableEvent.connection` Read only  
Experimental

Returns a references to the `PresentationConnection` object that fired the event.

Specifications
--------------

| Specification |
| --- |
| Presentation API # interface-presentationconnectionavailableevent |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
XRTransientInputHitTestResult
=============================

**Secure context:** This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

The **`XRTransientInputHitTestResult`** interface of the WebXR Device API contains an array of results of a hit test for transient input, grouped by input source.

You can get an array of `XRHitTestResult` objects for a frame by calling `XRFrame.getHitTestResultsForTransientInput()`.

Instance properties
-------------------

`XRTransientInputHitTestResult.inputSource` Read only  
Experimental

Represents the `XRInputSource` that was used to compute the `results` array.

`XRTransientInputHitTestResult.results` Read only  
Experimental

Represents an array of `XRHitTestResult` objects containing the hit test results for the input source, ordered by the distance along the ray used to perform the hit test, with the closest result at position 0.

Instance methods
----------------

None.

Examples
--------

### Accessing transient input hit test results

Two arrays are used to access transient input hit test results. First, you get an array of `XRTransientInputHitTestResult` objects by calling `XRFrame.getHitTestResultsForTransientInput()`. Second, to get to the actual `XRHitTestResult` objects for an input source, you dereference the `results` property on one of the `XRTransientInputHitTestResult` objects.


```js
// frame loop
function onXRFrame(time, xrFrame) {
  let hitTestResults = xrFrame.getHitTestResultsForTransientInput(
    transientHitTestSource,
  );

  hitTestResults.forEach((resultsPerInputSource) => {
    resultsPerInputSource.results.forEach((hitTest) => {
      // do something with the hit test
      hitTest.getPose(referenceSpace);
    });
  });
}
```

### Filtering input sources

The `inputSource` property allows you to filter hit test results by input source.


```js
// frame loop
function onXRFrame(time, xrFrame) {
  let hitTestResults = xrFrame.getHitTestResultsForTransientInput(
    transientHitTestSource,
  );

  hitTestResults.forEach((resultsPerInputSource) => {
    if (resultsPerInputSource.inputSource === myPreferredInputSource) {
      // act on hit test results from the preferred input source
    }
  });
}
```

Specifications
--------------

| Specification |
| --- |
| WebXR Hit Test Module # xr-transient-input-hit-test-result-interface |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `XRHitTestResult`
* `XRInputSource`
DocumentPictureInPicture
========================

**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

**Secure context:** This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The **`DocumentPictureInPicture`** interface of the Document Picture-in-Picture API is the entry point for creating and handling document picture-in-picture windows.

It is accessed via the `Window.documentPictureInPicture` property.

EventTarget

DocumentPictureInPictureInstance properties
-------------------

`window` Read only  
Experimental

Returns a `Window` instance representing the browsing context inside the Picture-in-Picture window.

Instance methods
----------------

`requestWindow()` 
Experimental

Opens the Picture-in-Picture window for the current main browsing context. Returns a `Promise` that fulfills with a `Window` instance representing the browsing context inside the Picture-in-Picture window.

Events
------

`enter` 
Experimental

Fired when the Picture-in-Picture window is successfully opened.

Examples
--------


```js
const videoPlayer = document.getElementById("player");

// ...

// Open a Picture-in-Picture window.
const pipWindow = await window.documentPictureInPicture.requestWindow({
  width: videoPlayer.clientWidth,
  height: videoPlayer.clientHeight,
});

// ...
```


See Document Picture-in-Picture API Example for a full working demo (see the full source code also).

Specifications
--------------

| Specification |
| --- |
| Document Picture-in-Picture Specification # documentpictureinpicture |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Document Picture-in-Picture API
* Using the Document Picture-in-Picture API
SVGSwitchElement
================

The **`SVGSwitchElement`** interface corresponds to the `<switch>` element.

EventTarget

Node

Element

SVGElement

SVGGraphicsElement

SVGSwitchElementInstance properties
-------------------

*This interface doesn't implement any specific properties, but inherits properties from its parent interface, `SVGGraphicsElement`.*

Instance methods
----------------

*This interface doesn't implement any specific methods, but inherits methods from its parent interface, `SVGGraphicsElement`.*

Specifications
--------------

| Specification |
| --- |
| Scalable Vector Graphics (SVG) 2 # InterfaceSVGSwitchElement |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
InputDeviceInfo
===============

**Secure context:** This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The **`InputDeviceInfo`** interface of the Media Capture and Streams API gives access to the capabilities of the input device that it represents.

`InputDeviceInfo` objects are returned by `MediaDevices.enumerateDevices()` if the returned device is an audio or video input device.

MediaDeviceInfo

InputDeviceInfoInstance properties
-------------------

*Also inherits properties from its parent interface, `MediaDeviceInfo`.*

Instance methods
----------------

*Also inherits methods from its parent interface, `MediaDeviceInfo`.*

`InputDeviceInfo.getCapabilities()`

Returns a `MediaTrackCapabilities` object describing the primary audio or video track of a device's `MediaStream`.

Examples
--------

The following example gets all media devices with `MediaDevices.enumerateDevices()`. If any of the devices are input devices then `console.log(device)` will print an `InputDeviceInfo` object to the console.


```js
navigator.mediaDevices.enumerateDevices().then((devices) => {
  devices.forEach((device) => {
    console.log(device); // an InputDeviceInfo object if the device is an input device, otherwise a MediaDeviceInfo object.
  });
});
```

Specifications
--------------

| Specification |
| --- |
| Media Capture and Streams # dom-inputdeviceinfo |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
IdentityProvider
================

**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

The **`IdentityProvider`** interface of the Federated Credential Management (FedCM) API represents an identity provider (IdP) and provides access to related information.

Static methods
--------------

`getUserInfo()` 
Experimental

Returns information about a previously signed in user on their return to an IdP, which can be used to provide a personalized welcome message and sign-in button.

Examples
--------


```js
// Iframe displaying a page from the https://idp.example origin
const user_info = await IdentityProvider.getUserInfo({
  configUrl: "https://idp.example/fedcm.json",
  clientId: "client1234",
});

// IdentityProvider.getUserInfo() returns an array of user information.
if (user_info.length > 0) {
  // Returning accounts should be first, so the first account received
  // is guaranteed to be a returning account
  const name = user_info[0].name;
  const given_name = user_info[0].given_name;
  const display_name = given_name ? given_name : name;
  const picture = user_info[0].picture;
  const email = user_info[0].email;

  // ...

  // Render the personalized sign-in button using the information returned above
}
```

Specifications
--------------

| Specification |
| --- |
| Federated Credential Management API # browser-api-identity-provider-interface |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Federated Credential Management API on developer.chrome.com (2023)
SVGFEFuncAElement
=================

The **`SVGFEFuncAElement`** interface corresponds to the `<feFuncA>` element.

EventTarget

Node

Element

SVGElement

SVGComponentTransferFunctionElement

SVGFEFuncAElementInstance properties
-------------------

*This interface not provide any specific properties, but inherits properties from its parent interface, `SVGComponentTransferFunctionElement`.*

Instance methods
----------------

*This interface does not provide any specific methods, but implements those of its parent, `SVGComponentTransferFunctionElement`.*

Specifications
--------------

| Specification |
| --- |
| Filter Effects Module Level 1 # InterfaceSVGFEFuncAElement |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `<feFuncA>`
Path2D
======

The **`Path2D`** interface of the Canvas 2D API is used to declare a path that can then be used on a `CanvasRenderingContext2D` object. The path methods of the `CanvasRenderingContext2D` interface are also present on this interface, which gives you the convenience of being able to retain and replay your path whenever desired.

Constructors
------------

`Path2D()`

`Path2D` constructor. Creates a new `Path2D` object.

Instance methods
----------------

`Path2D.addPath()`

Adds a path to the current path.

`Path2D.closePath()`

Causes the point of the pen to move back to the start of the current sub-path. It tries to draw a straight line from the current point to the start. If the shape has already been closed or has only one point, this function does nothing.

`Path2D.moveTo()`

Moves the starting point of a new sub-path to the (`x, y`) coordinates.

`Path2D.lineTo()`

Connects the last point in the subpath to the (`x, y`) coordinates with a straight line.

`Path2D.bezierCurveTo()`

Adds a cubic Bézier curve to the path. It requires three points. The first two points are control points and the third one is the end point. The starting point is the last point in the current path, which can be changed using `moveTo()` before creating the Bézier curve.

`Path2D.quadraticCurveTo()`

Adds a quadratic Bézier curve to the current path.

`Path2D.arc()`

Adds an arc to the path which is centered at (`x, y`) position with radius `r` starting at `startAngle` and ending at `endAngle` going in the given direction by `counterclockwise` (defaulting to clockwise).

`Path2D.arcTo()`

Adds a circular arc to the path with the given control points and radius, connected to the previous point by a straight line.

`Path2D.ellipse()`

Adds an elliptical arc to the path which is centered at (`x, y`) position with the radii `radiusX` and `radiusY` starting at `startAngle` and ending at `endAngle` going in the given direction by `counterclockwise` (defaulting to clockwise).

`Path2D.rect()`

Creates a path for a rectangle at position (`x, y`) with a size that is determined by `width` and `height`.

`Path2D.roundRect()`

Creates a path for a rounded rectangle at position (`x, y`) with a size that is determined by `width` and `height` and the radii of the circular arc to be used for the corners of the rectangle is determined by `radii`.

Specifications
--------------

| Specification |
| --- |
| HTML Standard # path2d-objects |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `CanvasRenderingContext2D`
ProgressEvent
=============

The **`ProgressEvent`** interface represents events measuring progress of an underlying process, like an HTTP request (for an `XMLHttpRequest`, or the loading of the underlying resource of an `<img>`, `<audio>`, `<video>`, `<style>` or `<link>`).

Event

ProgressEventConstructor
-----------

`ProgressEvent()`

Creates a `ProgressEvent` event with the given parameters.

Instance properties
-------------------

*Also inherits properties from its parent `Event`*.

`ProgressEvent.lengthComputable` Read only 

A boolean flag indicating if the total work to be done, and the amount of work already done, by the underlying process is calculable. In other words, it tells if the progress is measurable or not.

`ProgressEvent.loaded` Read only 

A 64-bit unsigned integer value indicating the amount of work already performed by the underlying process. The ratio of work done can be calculated by dividing `total` by the value of this property. When downloading a resource using HTTP, this only counts the body of the HTTP message, and doesn't include headers and other overhead.

`ProgressEvent.total` Read only 

A 64-bit unsigned integer representing the total amount of work that the underlying process is in the progress of performing. When downloading a resource using HTTP, this is the `Content-Length` (the size of the body of the message), and doesn't include the headers and other overhead.

Instance methods
----------------

*Inherits methods from its parent, `Event`.*

Examples
--------

The following example adds a `ProgressEvent` to a new `XMLHTTPRequest` and uses it to display the status of the request.


```js
const progressBar = document.getElementById("p"),
  client = new XMLHttpRequest();
client.open("GET", "magical-unicorns");
client.onprogress = (pe) => {
  if (pe.lengthComputable) {
    progressBar.max = pe.total;
    progressBar.value = pe.loaded;
  }
};
client.onloadend = (pe) => {
  progressBar.value = pe.loaded;
};
client.send();
```

Specifications
--------------

| Specification |
| --- |
| XMLHttpRequest Standard # interface-progressevent |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* The `Event` base interface.
SVGComponentTransferFunctionElement
===================================

The **`SVGComponentTransferFunctionElement`** interface defines a base interface used by the component transfer function interfaces.

EventTarget

Node

Element

SVGElement

SVGComponentTransferFunctionElementConstants
---------

| Name | Value | Description |
| --- | --- | --- |
| `SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN` | 0 | 
 The type is not one of predefined types. It is invalid to attempt to
 define a new value of this type or to attempt to switch an existing
 value to this type.
  |
| `SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY` | 1 | Corresponds to the value `identity`. |
| `SVG_FECOMPONENTTRANSFER_TYPE_TABLE` | 2 | Corresponds to the value `table`. |
| `SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE` | 3 | Corresponds to the value `discrete`. |
| `SVG_FECOMPONENTTRANSFER_TYPE_LINEAR` | 4 | Corresponds to the value `linear`. |
| `SVG_FECOMPONENTTRANSFER_TYPE_GAMMA` | 5 | Corresponds to the value `gamma`. |

Instance properties
-------------------

*This interface also inherits properties from its parent interface, `SVGElement`.*

`SVGComponentTransferFunctionElement.type` Read only 

An `SVGAnimatedEnumeration` corresponding to the `type` attribute of the given element. It takes one of the `SVG_FECOMPONENTTRANSFER_TYPE_*` constants defined on this interface.

`SVGComponentTransferFunctionElement.tableValues` Read only 

An `SVGAnimatedNumberList` corresponding to the `tableValues` attribute of the given element.

`SVGComponentTransferFunctionElement.slope` Read only 

An `SVGAnimatedNumber` corresponding to the `slope` attribute of the given element.

`SVGComponentTransferFunctionElement.intercept` Read only 

An `SVGAnimatedNumber` corresponding to the `intercept` attribute of the given element.

`SVGComponentTransferFunctionElement.amplitude` Read only 

An `SVGAnimatedNumber` corresponding to the `amplitude` attribute of the given element.

`SVGComponentTransferFunctionElement.exponent` Read only 

An `SVGAnimatedNumber` corresponding to the `exponent` attribute of the given element.

`SVGComponentTransferFunctionElement.offset` Read only 

An `SVGAnimatedNumber` corresponding to the `offset` attribute of the given element.

Instance methods
----------------

*This interface does not provide any specific methods, but implements those of its parent, `SVGElement`.*

Specifications
--------------

| Specification |
| --- |
| Filter Effects Module Level 1 # InterfaceSVGComponentTransferFunctionElement |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `SVGFEFuncAElement`
* `SVGFEFuncBElement`
* `SVGFEFuncGElement`
* `SVGFEFuncRElement`