recursal/MDN huggingface dataset:
Presentation: receiver property
===============================

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

 The **read-only** `Presentation` attribute
 `receiver`, which is only available in browser contexts which are
 **receiving** a presentation, returns the
 `PresentationReceiver` object which can be used to access and communicate
 with the browser context which controls the presentation. This property is always
 `null` when accessed from outside a browser context which is receiving a
 presentation.

Value
-----

 If the code is running in a context which is receiving a presentation, the returned
 value is a `PresentationReceiver` which can then be used to communicate
 with the context which is the source of the presentation.

 If the current context is not receiving a presentation, `receiver` is
 `null`.

Examples
--------

### Determining whether or not the context is receiving a presentation

 You can easily determine whether or not the context is the receiver for a presentation
 by checking the value of `navigator.receiver`. If it's a non-null value, then
 the context is indeed receiving a presentation. If it's `null`, there's no
 incoming presentation.


```js
footer.textContent = navigator.receiver ? "Receiving presentation" : "(idle)";
```

### Accessing the connection list

 This example uses `receiver` to access the list of incoming connections and
 to build and display a list of those connections' ID strings.


```js
let listElem = document.getElementById("connectionview");

navigator.presentation.receiver.connectionList.then((connections) => {
  connections.forEach((aConnection) => {
    listElem.innerHTML += `<li>${aConnection.id}</li>`;
  });
});
```


 After getting access to the output list element in the variable
 `connectionView`, `navigator.receiver` is used to get a
 reference to the `PresentationReceiver` object for this context, and its
 `connectionList` is used to get a
 `Promise` which will be called when the list is available.

 The promise handler receives as its input parameter an array of the incoming
 connections. We iterate over these using `forEach()`,
 appending a new item to the `connectionView` list element for each
 connection.

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

| Specification |
| --- |
| Presentation API # dom-presentation-receiver |

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

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

See also
--------

* Presentation API
* `Presentation`
* `PresentationReceiver`
Presentation: defaultRequest property
=====================================

**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.

In a controlling user agent, the **`defaultRequest`** attribute *MUST* return the default presentation request if any, otherwise `null`. In a receiving browsing context, it *MUST* return `null`.

If set by the controller, the value of the `defaultRequest` attribute *SHOULD* be used by the controlling user agent as the *default presentation request* for that controlling browsing context. If the document object's active sandboxing flag set has the sandboxed presentation browsing context flag set, the controlling user agent *SHOULD* act as if the default request is not set for that browsing context. When the controlling user agent wishes to initiate a `PresentationConnection` on the behalf of that browsing context, it *MUST* start a presentation using the default presentation request for the controller (as if the controller had called `defaultRequest.start()`).

The controlling user agent *SHOULD* initiate presentation using the default presentation request, only when the user has expressed an intention to do so via a user gesture. For example, by clicking a button in the browser.

**Note:** Some controlling user agents may allow the user to initiate a default presentation connection and select a presentation display with the same user gesture. For example, the browser chrome could allow the user to pick a display from a menu, or allow the user to tap on an Near Field Communications (NFC) enabled display. In this case, when the controlling user agent asks for permission while starting a presentation, the browser could offer that display as the default choice, or consider the gesture as granting permission for the display and bypass display selection entirely.

**Note:** If a controlling user agent does not support initiation of a presentation connection from the browser chrome, setting `defaultRequest` will have no effect.

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

| Specification |
| --- |
| Presentation API # dom-presentation-defaultrequest |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
HTMLTableRowElement: insertCell() method
========================================

 The **`HTMLTableRowElement.insertCell()`** method inserts a new
 cell (`<td>`) into a table row (`<tr>`) and returns a
 reference to the cell.


**Note:** `insertCell()` inserts the cell directly into the
 row. The cell does not need to be appended separately
 with `Node.appendChild()` as would be the case if
 `Document.createElement()` had been used to create the new
 `<td>` element.


 You can not use `insertCell()` to create a new `<th>`
 element though.


Syntax
------


```js
insertCell()
insertCell(index)
```


`HTMLTableRowElement` is a reference to an HTML `<tr>`
 element.

### Parameters

`index` Optional

The cell index of the new cell. If `index` is `-1` or equal to the number of cells, the cell is appended as the last cell in the row. If `index` is omitted it defaults to `-1`.

### Return value

 An `HTMLTableCellElement` that references the new
 cell.

### Exceptions

`IndexSizeError` `DOMException`

Thrown if `index` is greater than the number of cells.

Examples
--------

 This example uses `HTMLTableElement.insertRow()` to append a new row to a
 table.

 We then use `insertCell(0)` to insert a new cell in the new row. (To be
 valid HTML, a `<tr>` must have at least one `<td>`
 element.) Finally, we add some text to the cell using
 `Document.createTextNode()` and `Node.appendChild()`.

### HTML


```html
<table id="my-table">
  <tr>
    <td>Row 1</td>
  </tr>
  <tr>
    <td>Row 2</td>
  </tr>
  <tr>
    <td>Row 3</td>
  </tr>
</table>
```

### JavaScript


```js
function addRow(tableID) {
  // Get a reference to the table
  let tableRef = document.getElementById(tableID);

  // Insert a row at the end of the table
  let newRow = tableRef.insertRow(-1);

  // Insert a cell in the row at index 0
  let newCell = newRow.insertCell(0);

  // Append a text node to the cell
  let newText = document.createTextNode("New bottom row");
  newCell.appendChild(newText);
}

// Call addRow() with the table's ID
addRow("my-table");
```

### Result

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

| Specification |
| --- |
| HTML Standard # dom-tr-insertcell-dev |

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

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

See also
--------

* `HTMLTableElement.insertRow()`
* The HTML element representing cells: `HTMLTableCellElement`
HTMLTableRowElement: rowIndex property
======================================

 The **`HTMLTableRowElement.rowIndex`** read-only property
 represents the position of a row in relation to the whole `<table>`.

 Even when the `<thead>`, `<tbody>`, and
 `<tfoot>` elements are out of order in the HTML, browsers render the
 table in the right order. Therefore the rows count from `<thead>` to
 `<tbody>`, from `<tbody>` to
 `<tfoot>`.

Value
-----

Returns the index of the row, or `-1` if the row is not part of a table.

Examples
--------

This example uses JavaScript to label all the row numbers in a table.

### HTML


```html
<table>
  <thead>
    <tr>
      <th>Item</th>
      <th>Price</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Bananas</td>
      <td>$2</td>
    </tr>
    <tr>
      <td>Oranges</td>
      <td>$8</td>
    </tr>
    <tr>
      <td>Top Sirloin</td>
      <td>$20</td>
    </tr>
  </tbody>
  <tfoot>
    <tr>
      <td>Total</td>
      <td>$30</td>
    </tr>
  </tfoot>
</table>
```

### JavaScript


```js
let rows = document.querySelectorAll("tr");

rows.forEach((row) => {
  let z = document.createElement("td");
  z.textContent = `(row #${row.rowIndex})`;
  row.appendChild(z);
});
```

### Result

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

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

Limited availability
--------------------

This feature is not Baseline because it does not work in some of the most widely-used browsers.

* Learn more
* See full compatibility
* Report feedback
**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 **`completed`** read-only property of the `ImageDecoder` interface returns a promise that resolves once encoded data has finished buffering.

Value
-----

A `Promise` that resolves with `undefined` once `ImageDecoder.complete` is `true`.

Examples
--------

In the following example the value of `completed` will be `undefined` once the promise resolves.


```js
let completed = await imageDecoder.completed;
console.log(completed);
```

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

| Specification |
| --- |
| WebCodecs # dom-imagedecoder-completed |

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

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

Limited availability
--------------------

This feature is not Baseline because it does not work in some of the most widely-used browsers.

* Learn more
* See full compatibility
* Report feedback
**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 **`complete`** read-only property of the `ImageDecoder` interface returns true if encoded data has completed buffering.

Value
-----

A `boolean`, `true` if buffering is complete.

Examples
--------

The following example prints the value of `complete` to the console.


```js
console.log(imageDecoder.complete);
```

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

| Specification |
| --- |
| WebCodecs # dom-imagedecoder-complete |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
ImageDecoder: decode() method
=============================

Limited availability
--------------------

This feature is not Baseline because it does not work in some of the most widely-used browsers.

* Learn more
* See full compatibility
* Report feedback
**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 **`decode()`** method of the `ImageDecoder` interface enqueues a control message to decode the frame of an image.

Syntax
------


```js
decode()
decode(options)
```

### Parameters

`options` Optional

An object containing the following members:

`frameIndex` Optional

An integer representing the index of the frame to decode. Defaults to `0` (the first frame).

`completeFramesOnly` Optional

A `boolean` defaulting to `true`. When `false` indicates that for progressive images the decoder may output an image with reduced detail. When `false`, the promise returned by `decode()` will resolve exactly once for each new level of detail.


### Return value

A `promise` that resolves with an object containing the following members:

`image`

A `VideoFrame` containing the decoded image.

`complete`

A `boolean`, if `true` indicates that `image` contains the final full-detail output.

### Exceptions

If an error occurs, the promise will resolve with following exception:

`InvalidStateError` `DOMException`

Returned if any of the following conditions apply:

* `close` is true, meaning `close()` has already been called.
* The requested frame does not exist.

Examples
--------

### Synchronous decoding of a completed image frame

The following example decodes the second frame (at index `1`) and prints the resulting `VideoFrame` to the console.


```js
let result = await imageDecoder.decode({ frameIndex: 1 });
console.log(result.image);
```

### Partial decoding of a progressive image frame

The following example decodes the first frame repeatedly until its complete:


```js
let complete = false;
while (!complete) {
  // The promise returned by `decode()` will only resolve when a new
  // level of detail is available or the frame is complete. I.e.,
  // calling `decode()` in a loop like this is won't needlessly spin.
  let result = await imageDecode.decode({ completeFramesOnly: false });

  // Do something with `result.image`.

  complete = result.complete;
}
```

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

| Specification |
| --- |
| WebCodecs # dom-imagedecoder-decode |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
ImageDecoder: isTypeSupported() static method
=============================================

Limited availability
--------------------

This feature is not Baseline because it does not work in some of the most widely-used browsers.

* Learn more
* See full compatibility
* Report feedback
**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 **`ImageDecoder.isTypeSupported()`** static method checks if a given MIME type can be decoded by the user agent.

Syntax
------


```js
ImageDecoder.isTypeSupported(type)
```

### Parameters

`type`

A string containing the MIME type to check for decoding support.

### Return value

A `promise` that resolves with a boolean value indicating whether images with a format of `type` can be decoded by the API.

Examples
--------

The following example checks if GIF and PCX images are supported for decoding and prints the result to the console.


```js
let isGifSupported = await ImageDecoder.isTypeSupported("image/gif");
console.log(`GIF supported: ${isGifSupported}`); // Likely true.

let isPcxSupported = await ImageDecoder.isTypeSupported("image/pcx");
console.log(`PCX supported: ${isPcxSupported}`); // Probably false
```

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

| Specification |
| --- |
| WebCodecs # dom-imagedecoder-istypesupported |

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

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

Limited availability
--------------------

This feature is not Baseline because it does not work in some of the most widely-used browsers.

* Learn more
* See full compatibility
* Report feedback
**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 **`tracks`** read-only property of the `ImageDecoder` interface returns a list of the tracks in the encoded image data.

Value
-----

An `ImageTrackList`.

Examples
--------

The following example prints the value of `tracks` to the console. This will be an `ImageTrackList` object.


```js
console.log(imageDecoder.tracks);
```

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

| Specification |
| --- |
| WebCodecs # dom-imagedecoder-tracks |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
ImageDecoder: reset() method
============================

Limited availability
--------------------

This feature is not Baseline because it does not work in some of the most widely-used browsers.

* Learn more
* See full compatibility
* Report feedback
**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 **`reset()`** method of the `ImageDecoder` interface aborts all pending `decode()` operations; rejecting all pending promises. All other state will be unchanged. Class methods can continue to be invoked after `reset()`. E.g., calling `decode()` after `reset()` is permitted.

Syntax
------


```js
reset()
```

### Parameters

None.

### Return value

None (`undefined`).

Examples
--------

The following example resets the `ImageDecoder`.


```js
for (let i = 0; i < imageDecoder.tracks.selectedTrack.frameCount; ++i)
  imageDecoder.decode({ frameIndex: i }).catch(console.log);
imageDecoder.reset();
imageDecoder.decode({ frameIndex: 0 }).then(console.log);
```

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

| Specification |
| --- |
| WebCodecs # dom-imagedecoder-reset |

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

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

Limited availability
--------------------

This feature is not Baseline because it does not work in some of the most widely-used browsers.

* Learn more
* See full compatibility
* Report feedback
**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 **`type`** read-only property of the `ImageDecoder` interface reflects the MIME type configured during construction.

Value
-----

A string containing the configured MIME type.

Examples
--------

The following example prints the value of `type` to the console.


```js
console.log(imageDecoder.type);
```

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

| Specification |
| --- |
| WebCodecs # dom-imagedecoder-type |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
ImageDecoder: close() method
============================

Limited availability
--------------------

This feature is not Baseline because it does not work in some of the most widely-used browsers.

* Learn more
* See full compatibility
* Report feedback
**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 **`close()`** method of the `ImageDecoder` interface ends all pending work and releases system resources.

Syntax
------


```js
close()
```

### Parameters

None.

### Return value

None (`undefined`).

Examples
--------

The following example closes the `ImageDecoder`.


```js
imageDecoder.close();
```

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

| Specification |
| --- |
| WebCodecs # dom-imagedecoder-close |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
ImageDecoder: ImageDecoder() constructor
========================================

Limited availability
--------------------

This feature is not Baseline because it does not work in some of the most widely-used browsers.

* Learn more
* See full compatibility
* Report feedback
**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 **`ImageDecoder()`** constructor creates a new `ImageDecoder` object which unpacks and decodes image data.

Syntax
------


```js
new ImageDecoder(init)
```

### Parameters

`init`

An object containing the following members:

`type`

A string containing the MIME type of the image file to be decoded.

`data`

An `ArrayBuffer`, a `TypedArray`, a `DataView`, or a `ReadableStream` of bytes representing an encoded image type as described by `type`.

`premultiplyAlpha` Optional

Specifies whether the decoded image's color channels should be premultiplied by the alpha channel. If not provided set as `"default"`:

* `"none"`
* `"premultiply"`
* `"default"`

`colorSpaceConversion` Optional

Specifies whether the image should be decoded using color space conversion. If not provided set as `"default"`. The value `"default"` indicates that implementation-specific behavior is used:

* `"none"`
* `"default"`

`desiredWidth` Optional

An integer indicating the desired width for the decoded output. Has no effect unless the image codec supports variable resolution decoding.

`desiredHeight` Optional

An integer indicating the desired height for the decoded output. Has no effect unless the image codec supports variable resolution decoding.

`preferAnimation` Optional

A `Boolean` indicating whether the initial track selection should prefer an animated track.

`transfer`

An array of `ArrayBuffer`s that `ImageDecoder` will detach and take ownership of. If the array contains the `ArrayBuffer` backing `data`, `ImageDecoder` will use that buffer directly instead of copying from it.


Examples
--------

The following example creates a new `ImageDecoder` with the required options.


```js
let init = {
  type: "image/png",
  data: imageByteStream,
};

let imageDecoder = new ImageDecoder(init);
```

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

| Specification |
| --- |
| WebCodecs # dom-imagedecoder-imagedecoder |

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

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

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

The *read-only* **`primaryLightIntensity`** property of the `XRLightEstimate` interface returns a `DOMPointReadOnly` representing the intensity of the primary light source from the `probeSpace` of an `XRLightProbe`.

Value
-----

A `DOMPointReadOnly` object where an RGB value is mapped to the `x`, `y`, and `z` values. The `w` value is always `1.0`. If no estimated values from the user's environment are available, the point will be `{x: 0.0, y: 0.0, z: 0.0, w: 1.0}`, representing no illumination.

Examples
--------

 Within an `XRFrame` loop, you can use the `primaryLightDirection` and `primaryLightIntensity` properties
 to render shadows based on the most prominent light source, for example.


```js
const lightProbe = await xrSession.requestLightProbe();

// frame loop
function onXRFrame(time, xrFrame) {
  let lightEstimate = xrFrame.getLightEstimate(lightProbe);

  // Render lights

  // Available properties
  lightEstimate.primaryLightDirection;
  lightEstimate.primaryLightIntensity;
}
```

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

| Specification |
| --- |
| WebXR Lighting Estimation API Level 1 # dom-xrlightestimate-primarylightintensity |

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

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

See also
--------

* `XRLightEstimate.primaryLightDirection`
* `XRLightProbe.probeSpace`