recursal/MDN huggingface dataset:
RTCIceCandidate: tcpType property
=================================

The **`RTCIceCandidate`** interface's read-only **`tcpType`** property is included on TCP candidates to provide additional details about the candidate type.

 The `tcpType` field's value is set from the `candidateInfo` options object passed to the `RTCIceCandidate()` constructor.
 You can't specify the value of `tcpType` directly in the options object, but its value is automatically extracted from the object's `candidate` a-line, if it's formatted properly.

Value
-----

If the `protocol` is "tcp", `tcpType` has one of the following values:

`"active"`

The transport will try to open an outbound connection but won't receive incoming connection requests.

`"passive"`

The transport will receive incoming connection requests but won't try to open an outbound connection.

`"so"`

The transport will try to open a connection simultaneously with its peer.

`tcpType` is `null` for UDP candidates.

Examples
--------

 In this example, the candidate's `protocol`
 and `tcpType` are used to adjust the user interface for simultaneous-open TCP candidates.


```js
if (candidate.protocol === "tcp" && candidate.tcpType === "so") {
  adjustForSimultaneousOpen(candidate);
}
```

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

| Specification |
| --- |
| WebRTC: Real-Time Communication in Browsers # dom-rtcicecandidate-tcptype |

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

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

See also
--------

* WebRTC API
* Introduction to WebRTC protocols
* WebRTC connectivity
* `RTCIceCandidate.protocol`
* `RTCIceCandidate.type`
RTCIceCandidate: port property
==============================

 The **`RTCIceCandidate`** interface's read-only **`port`** property contains the port
 number on the device at the address given by `RTCIceCandidate.address` at which the candidate's peer can be reached.

 The `port` field's value is set from the `candidateInfo` options object passed to the `RTCIceCandidate()` constructor.
 You can't specify the value of `port` directly in the options object, but its value is automatically extracted from the object's `candidate` a-line, if it's formatted properly.

Value
-----

A 16-bit number indicating the port number on the device at the address indicated by `address` at which the candidate's peer can be reached.

`port` is initialized to `null` if it is not specified in the
 `candidate`, or if the `candidate` string can't be parsed properly.


**Note:** If `port` is `null`, passing the candidate to `addIceCandidate()`
 will fail, throwing an `OperationError` exception.
 This applies only if the candidate implements `port`.


Usage notes
-----------

 Consider this SDP attribute line (a-line) which describes an ICE
 candidate:
```

a=candidate:4234997325 1 udp 2043278322 192.0.2.172 44323 typ host
```


The port number is found in the sixth field, which is `"44323"`. In this case, the value of `port` will be 44323.

Examples
--------

 This code snippet fetches the IP address and port number of the candidate, storing them
 into an object for future use.


```js
const candidateLoc = {
  address: candidate.ip,
  port: candidate.port,
};
```

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

| Specification |
| --- |
| WebRTC: Real-Time Communication in Browsers # dom-rtcicecandidate-port |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
RTCIceCandidate: sdpMLineIndex property
=======================================

 The read-only **`sdpMLineIndex`** property on the `RTCIceCandidate` interface
 is a zero-based index of the m-line describing the media associated with the candidate.

 This property can be configured by specifying the value of the `sdpMLineIndex` property in the `candidateInfo` options object that is passed to the `RTCIceCandidate()` constructor.
 If you call the constructor with an m-line string instead of the options object, the value of `sdpMLineIndex` is extracted from the specified candidate m-line string.

Value
-----

 A number containing a 0-based index into the set of m-lines providing media descriptions,
 indicating which media source is associated with the candidate, or `null` if no such association is available.


**Note:** Attempting to add a candidate (using
 `addIceCandidate()`) that has a
 value of `null` for either `sdpMid` or
 `sdpMLineIndex` will throw a `TypeError` exception.


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

| Specification |
| --- |
| WebRTC: Real-Time Communication in Browsers # dom-rtcicecandidate-sdpmlineindex |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
RTCIceCandidate: component property
===================================

 The read-only **`component`** property
 on the `RTCIceCandidate` interface is a string which indicates whether
 the candidate is an RTP or
 an RTCP candidate.

 If a candidate represents both RTP and RTCP multiplexed together, it is reported as an
 RTP candidate.

Value
-----

A string which is one of the following:

`rtp`

Identifies an ICE transport which is being used for the Real-time Transport Protocol (RTP), or for RTP multiplexed with the RTP Control Protocol (RTCP). RTP is defined in RFC 3550. This value corresponds to the component ID field in the `candidate` a-line with the value 1.

`rtcp`

Identifies an ICE transport being used for RTCP, which is defined in RFC 3550, section 6. This value corresponds to the component ID 2.

Usage notes
-----------

Consider this SDP attribute line (a-line):
```

a=candidate:4234997325 1 udp 2043278322 192.0.2.172 44323 typ host
```


 This is an ICE candidate a-line, whose `foundation` is 4234997325. The next field on the a-line, `"1"`, is the
 component ID. A value of `"1"` indicates RTP, which is recorded in the
 `component` property as `"rtp"`. If this value were instead
 `"2"`, the a-line would be describing an RTCP candidate, and
 `component` would be `"rtcp"`.

Examples
--------

 This code snippet examines a candidate's component type and dispatches the candidate to
 different handlers depending on the value.


```js
if (candidate.component === "rtp") {
  handleRTPCandidate(candidate);
} else if (candidate.component === "rtcp") {
  handleRTCPCandidate(candidate);
} else {
  handleUnknownCandidate(candidate);
}
```

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

| Specification |
| --- |
| WebRTC: Real-Time Communication in Browsers # dom-rtcicecandidate-component |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
RTCIceCandidate: priority property
==================================

The **`RTCIceCandidate`** interface's read-only **`priority`** property specifies the candidate's priority according to the remote peer; the higher this value is, the better the remote peer considers the candidate to be.

 The `priority` field's value is set from the `candidateInfo` options object passed to the `RTCIceCandidate()` constructor.
 You can't specify the value of `priority` directly in the options object, but its value is automatically extracted from the object's `candidate` a-line, if it's formatted properly.

Value
-----

 A long, unsigned integer value indicating the priority of the candidate according to the remote peer.
 The larger this value is, the more preferable the remote peer considers this candidate to be.

`priority` is initialized to `null` if it is not specified in the `candidate`, or if the `candidate` string can't be parsed properly.

**Note:** If `priority` is `null`, passing the
 candidate to `addIceCandidate()`
 will fail, throwing an `OperationError` exception. This applies only if the
 candidate implements the `priority` property.


Usage notes
-----------

Consider this SDP attribute line (a-line) which describes an ICE candidate:
```

a=candidate:4234997325 1 udp 2043278322 192.0.2.172 44323 typ host
```


 The priority is the number after the protocol, so it's the fourth field in the candidate string.
 In this example, the priority is 2043278322.

Examples
--------

 This candidate examines the `priority` of the candidate and, if it's greater
 than the priority of a previously-seen candidate, remembers the candidate for later use.


```js
let bestCandidate = {
  candidate: "",
  sdpMid: null,
  sdpMLineIndex: null,
  priority: 0,
};

function handleCandidate(candidateString) {
  const candidate = new RTCIceCandidate(candidateString);

  if (candidate.priority > bestCandidate.priority) {
    bestCandidate = candidate;
  }
}
```

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

| Specification |
| --- |
| WebRTC: Real-Time Communication in Browsers # dom-rtcicecandidate-priority |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
RTCIceCandidate: candidate property
===================================

 The read-only property **`candidate`** on the `RTCIceCandidate` interface returns a string describing the candidate in detail.
 Most of the other properties of `RTCIceCandidate` are actually extracted from this string.

This property can be configured using the `candidate` property of the object passed into the `RTCIceCandidate() constructor` or `RTCPeerConnection.addIceCandidate()`.

Value
-----

 A string describing the properties of the candidate, taken directly from the SDP attribute `"candidate"`.
 The candidate string specifies the network connectivity information for the candidate.
 If the `candidate` is an empty string (`""`), the end of the candidate list has been reached; this candidate is known as the "end-of-candidates" marker.

The syntax of the candidate string is described in RFC 5245, section 15.1. For an a-line (attribute line) that looks like this:
```

a=candidate:4234997325 1 udp 2043278322 192.0.2.172 44323 typ host
```


the corresponding `candidate` string's value will be: `"candidate:4234997325 1 udp 2043278322 192.0.2.172 44323 typ host"`.

 The user agent always prefers candidates with the highest
 `priority`, all else being equal. In the
 example above, the priority is `2043278322`. The attributes are all separated
 by a single space character, and are in a specific order. The complete list of
 attributes for this example candidate is:

* `foundation` = 4234997325
* `component` = `"rtp"` (the number 1 is encoded to this string; 2 becomes `"rtcp"`)
* `protocol` = `"udp"`
* `priority` = 2043278322
* `ip` = `"192.0.2.172"`
* `port` = 44323
* `type` = `"host"`
Examples
--------

 In this example, we see a function which receives as input an SDP string containing an
 ICE candidate received from the remote peer during the signaling process.


```js
function handleNewIceCandidate(candidateSDP) {
  const candidateObj = new RTCIceCandidate(candidateSDP);

  myPeerConnection.addIceCandidate(candidateObj).catch({
    /\* handle the error thrown by addIceCandidate() \*/
  });
}
```


 The `handleNewIceCandidate()` function shown here passes the received
 candidate's SDP text into `RTCIceCandidate()` to receive an `RTCIceCandidate` object in return,
 which represents the candidate.

 The new candidate is then passed into `RTCPeerConnection.addIceCandidate()` to add the candidate to the list of
 candidates for WebRTC to consider using for the connection being established.

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

| Specification |
| --- |
| WebRTC: Real-Time Communication in Browsers # dom-rtcicecandidate-candidate |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
XRRay: origin property
======================

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

The *read-only* **`origin`** property of the `XRRay` interface is a `DOMPointReadOnly` representing the 3-dimensional point in space that the ray originates from, in meters.

Value
-----

A `DOMPointReadOnly` object.

Examples
--------

### Using the `origin` property

The `origin` property contains the 3-dimensional point in space that the ray originates from, in meters.


```js
let origin = { x: 10.0, y: 10.0, z: 10.0, w: 1.0 };
let direction = { x: 10.0, y: 0.0, z: 0.0, w: 0.0 };
let ray = new XRRay(origin, direction);

ray.origin;
// returns DOMPointReadOnly {x : 10.0, y : 10.0, z : 10.0, w : 1.0}
```

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

| Specification |
| --- |
| WebXR Hit Test Module # dom-xrray-origin |

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

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

See also
--------

* `DOMPointReadOnly`
XRRay: matrix property
======================

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

The *read-only* **`matrix`** property of the `XRRay` interface is a transform that can be used to position objects along the `XRRay`. This is a 4 by 4 matrix given as a 16 element `Float32Array` in column major order.

The transform from a ray originates at [0, 0, 0] and extends down the negative z-axis to the ray described by the `XRRay`'s `origin` and `direction`.

Value
-----

A 16 element `Float32Array` object representing a 4 by 4 matrix in column major order.

Examples
--------

### Using the `matrix` property

The `matrix` property can be used to position graphical representations of the ray when rendering.


```js
let origin = { x: 10.0, y: 10.0, z: 10.0, w: 1.0 };
let direction = { x: 10.0, y: 0.0, z: 0.0, w: 0.0 };
let ray = new XRRay(origin, direction);

// Render the ray using the `ray.matrix` transform
```

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

| Specification |
| --- |
| WebXR Hit Test Module # dom-xrray-matrix |

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

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

See also
--------

* `Float32Array`
XRRay: direction property
=========================

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

The *read-only* **`direction`** property of the `XRRay` interface is a `DOMPointReadOnly` representing the ray's 3-dimensional directional vector, normalized to a unit vector with a length of 1.0.

Value
-----

A `DOMPointReadOnly` object.

Examples
--------

### Using the `direction` property

The `direction` property contains the normalized ray's 3-dimensional directional vector.


```js
let origin = { x: 10.0, y: 10.0, z: 10.0, w: 1.0 };
let direction = { x: 10.0, y: 0.0, z: 0.0, w: 0.0 };
let ray = new XRRay(origin, direction);

ray.direction;
// returns DOMPointReadOnly {x : 1.0, y : 0.0, z : 0.0, w : 0.0}
```

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

| Specification |
| --- |
| WebXR Hit Test Module # dom-xrray-direction |

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

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

See also
--------

* `DOMPointReadOnly`
XRRay: XRRay() constructor
==========================

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

The **`XRRay()`** constructor creates a new `XRRay` object which is a geometric ray described by an origin point and a direction vector.

Syntax
------


```js
new XRRay()
new XRRay(origin)
new XRRay(origin, direction)
new XRRay(transform)
```

### Parameters

`origin` Optional

A point object defining the 3-dimensional point in space that the ray originates from, in meters. All dimensions are optional, however, if provided, the origin's `w` property must be 1.0. The object is initialized to `{ x: 0.0, y: 0.0, z: 0.0, w: 1.0 }` by default.

`direction` Optional

A vector object defining the ray's 3-dimensional directional vector. All dimensions are optional, however, if provided, the direction's `w` property must be 0.0. The object is initialized to: `{ x: 0.0, y: 0.0, z: -1.0, w: 0.0 }` by default.

`transform` Optional

An `XRRigidTransform` object representing the position and orientation of the ray.

### Return value

A newly-created `XRRay` object.

### Exceptions

`TypeError`

Thrown if one of the following conditions is met:

* all of `direction`'s `x`, `y`, and `z` coordinates are zero.
* `direction`'s `w` coordinate is not 0.0.
* `origin`'s `w` coordinate is not 1.0.

Examples
--------

### Creating `XRRay` objects

The `XRRay()` constructor allows to creating new rays by either providing an `origin` point and a `direction` vector, or by passing in an `XRRigidTransform` object.


```js
// Default configuration
let ray1 = new XRRay();

// Specifying origin, leaving direction as default
let ray2 = new XRRay({ y: 0.5 });

// Specifying both, origin and direction
let origin = { x: 10.0, y: 10.0, z: 10.0, w: 1.0 };
let direction = { x: 10.0, y: 0.0, z: 0.0, w: 0.0 };
let ray3 = new XRRay(origin, direction);

// Using DOMPoint.fromPoint
let ray4 = new XRRay(DOMPoint.fromPoint(origin), DOMPoint.fromPoint(direction));

// Using rigid transform
let rigidTransform = new XRRigidTransform(
  DOMPoint.fromPoint(origin),
  DOMPoint.fromPoint(direction),
);
let ray5 = new XRRay(rigidTransform);
```

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

| Specification |
| --- |
| WebXR Hit Test Module # dom-xrray-xrray |

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

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

See also
--------

* `DOMPoint`
* `DOMPoint.fromPoint()`
IDBFactory: databases() method
==============================

The **`databases`** method of the `IDBFactory` interface returns a list representing all the available databases, including their names and versions.

**Note:** This feature is available in Web Workers

**Note:** This method is introduced in a draft of a specifications and browser compatibility is limited.

Syntax
------


```js
databases()
```

### Parameters

The method does not take in any parameters.

### Return value

A promise that resolves either to an error or a list of dictionaries, each with two elements, `name` and `version`:

`name`

The database name.

`version`

The database version.

### Exceptions

`SecurityError` `DOMException`

Thrown if the method is called from an opaque origin.

Examples
--------


```js
const promise = indexedDB.databases();
promise.then((databases) => {
  console.log(databases);
});
```

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

| Specification |
| --- |
| Indexed Database API 3.0 # ref-for-dom-idbfactory-databases① |

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

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

See also
--------

* Using IndexedDB
* Starting transactions: `IDBDatabase`
* Using transactions: `IDBTransaction`
* Setting a range of keys: `IDBKeyRange`
* Retrieving and making changes to your data: `IDBObjectStore`
* Using cursors: `IDBCursor`
* Reference example: To-do Notifications (View the example live).
IDBFactory: cmp() method
========================

 The **`cmp()`** method of the `IDBFactory`
 interface compares two values as keys to determine equality and ordering for IndexedDB
 operations, such as storing and iterating.

**Note:** This feature is available in Web Workers


**Note:** Do not use this method for comparing arbitrary JavaScript
 values, because many JavaScript values are either not valid IndexedDB keys (booleans
 and objects, for example) or are treated as equivalent IndexedDB keys (for example,
 since IndexedDB ignores arrays with non-numeric properties and treats them as empty
 arrays, so any non-numeric arrays are treated as equivalent). This throws an exception
 if either of the values is not a valid key.


Syntax
------


```js
cmp(first, second)
```

### Parameters

`first`

The first key to compare.

`second`

The second key to compare.

### Return value

 An integer that indicates the result of the comparison; the table below lists the
 possible values and their meanings:


| Returned value | Description |
| --- | --- |
| -1 | 1st key is less than the 2nd key |
| 0 | 1st key is equal to the 2nd key |
| 1 | 1st key is greater than the 2nd key |

### Exceptions

`DataError` `DOMException`

Thrown if one of the supplied keys was not a valid key.

Examples
--------


```js
const a = 1;
const b = 2;
const result = window.indexedDB.cmp(a, b);
console.log(`Comparison results: ${result}`);
```

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

| Specification |
| --- |
| Indexed Database API 3.0 # ref-for-dom-idbfactory-cmp① |

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

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

See also
--------

* Using IndexedDB
* Starting transactions: `IDBDatabase`
* Using transactions: `IDBTransaction`
* Setting a range of keys: `IDBKeyRange`
* Retrieving and making changes to your data: `IDBObjectStore`
* Using cursors: `IDBCursor`
* Reference example: To-do Notifications (View the example live).
IDBFactory: deleteDatabase() method
===================================

 The **`deleteDatabase()`** method of the
 `IDBFactory` interface requests the deletion of a database. The method
 returns an `IDBOpenDBRequest` object immediately, and performs the deletion
 operation asynchronously.

 If the database is successfully deleted, then a `success` event is fired on
 the request object returned from this method, with its `result` set to
 `undefined`. If an error occurs while the database is being deleted, then an
 `error` event is fired on the request object that is returned from this
 method.

 When `deleteDatabase()` is called, any other open connections to this
 particular database will get a versionchange event.

**Note:** This feature is available in Web Workers

Syntax
------


```js
// For the current standard:
deleteDatabase(name)

// For the experimental version with `options` (see below):
deleteDatabase(name)
deleteDatabase(name, options)
```

### Parameters

`name`

 The name of the database you want to delete. Note that attempting to delete a
 database that doesn't exist does not throw an exception, in contrast to
 `IDBDatabase.deleteObjectStore()`, which does throw an exception if the
 named object store does not exist.


`options` Optional 
Non-standard

 In Gecko, since version 26, you can include
 a non-standard optional storage parameter that specifies whether you want to delete a
 `permanent` (the default value) IndexedDB, or an indexedDB in
 `temporary` storage (aka shared pool.)


### Return value

A `IDBOpenDBRequest` on which subsequent events related to this request are fired.

If the operation is successful, the value of the request's `result` property is `null`.

Examples
--------


```js
const DBDeleteRequest = window.indexedDB.deleteDatabase("toDoList");

DBDeleteRequest.onerror = (event) => {
  console.error("Error deleting database.");
};

DBDeleteRequest.onsuccess = (event) => {
  console.log("Database deleted successfully");

  console.log(event.result); // should be undefined
};
```

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

| Specification |
| --- |
| Indexed Database API 3.0 # ref-for-dom-idbfactory-deletedatabase① |

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

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

See also
--------

* Using IndexedDB
* Starting transactions: `IDBDatabase`
* Using transactions: `IDBTransaction`
* Setting a range of keys: `IDBKeyRange`
* Retrieving and making changes to your data: `IDBObjectStore`
* Using cursors: `IDBCursor`
* Reference example: To-do Notifications (View the example live).