recursal/MDN huggingface dataset:
WebTransport: 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
The **`close()`** method of the `WebTransport` interface closes an ongoing WebTransport session.

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

Syntax
------


```js
close(info)
```

### Parameters

`info` Optional

An object containing the following properties:

`closeCode`

A number representing the error code for the error.

`reason`

A string representing the reason for closing the `WebTransport`.


### Return value

`undefined`.

### Exceptions

`WebTransportError`

Thrown if `close()` is invoked while the WebTransport is in the process of connecting.

Examples
--------


```js
const url = "https://example.com:4999/wt";
// Initialize transport connection
const transport = new WebTransport(url);

// ...

transport.close({
  closeCode: 017,
  reason: "CloseButtonPressed",
});
```

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

| Specification |
| --- |
| WebTransport # dom-webtransport-close |

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

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

See also
--------

* Using WebTransport
* WebSockets API
* Streams API
* WebTransport over HTTP/3
WebTransport: reliability property
==================================

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

The **`reliability`** read-only property of the `WebTransport` interface indicates whether the connection supports reliable transports only, or whether it also supports unreliable transports (such as UDP).

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

Value
-----

A string with one of the following values:

`pending`

 The connection has not yet been established.
 The reliability is not yet known.


`reliable-only`

The connection only supports reliable transports.

`supports-unreliable`

The connection supports both unreliable and reliable transports.

Examples
--------


```js
const url = "https://example.com:4999/wt";

async function initTransport(url) {
  // Initialize transport connection
  const transport = new WebTransport(url);

  // Once ready fulfils the connection can be used
  // Prior to this the reliability is "pending"
  await transport.ready;

  if (transport.reliability == "reliable-only") {
    // Use connection only with reliable transports
  } else {
    // Use connection with either reliable or unreliable transports.
  }
  // ...
}
```

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

| Specification |
| --- |
| WebTransport # dom-webtransport-reliability |

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

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

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

 The **`SpeechGrammarList()`** constructor creates a new
 `SpeechGrammarList` object instance.

Syntax
------


```js
new SpeechGrammarList()
```

### Parameters

None.

Examples
--------

 In our simple Speech color changer example, we create a new `SpeechRecognition` object
 instance using the `SpeechRecognition()` constructor, create a new `SpeechGrammarList`, add
 our grammar string to it using the `SpeechGrammarList.addFromString`
 method, and set it to be the grammar that will be recognized by the
 `SpeechRecognition` instance using the
 `SpeechRecognition.grammars` property.


```js
const grammar =
  "#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;";
const recognition = new SpeechRecognition();
const speechRecognitionList = new SpeechGrammarList();
speechRecognitionList.addFromString(grammar, 1);
recognition.grammars = speechRecognitionList;
```

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

| Specification |
| --- |
| Web Speech API # dom-speechgrammarlist-speechgrammarlist |

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

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

See also
--------

* Web Speech API
SpeechGrammarList: length property
==================================

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

 The **`length`** read-only property of the
 `SpeechGrammarList` interface returns the number of
 `SpeechGrammar` objects contained in the `SpeechGrammarList`.

Value
-----

 A number indicating the number of `SpeechGrammar` objects contained in the
 `SpeechGrammarList`.

Examples
--------


```js
const grammar =
  "#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;";
const recognition = new SpeechRecognition();
const speechRecognitionList = new SpeechGrammarList();
speechRecognitionList.addFromString(grammar, 1);
recognition.grammars = speechRecognitionList;

speechRecognitionList.length; // should return 1.
```

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

| Specification |
| --- |
| Web Speech API # dom-speechgrammarlist-length |

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

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

See also
--------

* Web Speech API
SpeechGrammarList: item() method
================================

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

 The **`item`** getter of the `SpeechGrammarList`
 interface is a standard getter — it allows individual `SpeechGrammar`
 objects to be retrieved from the `SpeechGrammarList` using array syntax.

Syntax
------


```js
item(index)
```

### Parameters

`index`

Index of the item to retrieve.

### Return value

A `SpeechGrammar` object.

Examples
--------


```js
const grammar =
  "#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;";
const recognition = new SpeechRecognition();
const speechRecognitionList = new SpeechGrammarList();
speechRecognitionList.addFromString(grammar, 1);
recognition.grammars = speechRecognitionList;

const myFirstGrammar = speechRecognitionList[0]; // variable contain the object created above
```

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

| Specification |
| --- |
| Web Speech API # dom-speechgrammarlist-item |

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

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

See also
--------

* Web Speech API
SpeechGrammarList: addFromURI() method
======================================

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

 The **`addFromURI()`** method of the
 `SpeechGrammarList` interface takes a grammar present at a specific URI and
 adds it to the `SpeechGrammarList` as a new `SpeechGrammar`
 object.

 Note that some speech recognition services may support built-in grammars that can be
 specified by URI.

Syntax
------


```js
addFromURI(src)
addFromURI(src, weight)
```

### Parameters

`src`

A string representing the URI of the grammar to be added.

`weight` Optional

 A float representing the weight of the grammar relative to other grammars present in
 the `SpeechGrammarList`. The weight means the importance of this grammar,
 or the likelihood that it will be recognized by the speech recognition service. The
 value can be between `0.0` and `1.0`; If not specified, the
 default used is `1.0`.


### Return value

None (`undefined`).

Examples
--------


```js
const grammar =
  "#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;";
const recognition = new SpeechRecognition();
const speechRecognitionList = new SpeechGrammarList();
speechRecognitionList.addFromString(grammar, 1);
recognition.grammars = speechRecognitionList;

speechRecognitionList.addFromURI("http://www.example.com/grammar.txt"); // adds a second grammar to the list.
```

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

| Specification |
| --- |
| Web Speech API # dom-speechgrammarlist-addfromuri |

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

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

See also
--------

* Web Speech API
SpeechGrammarList: addFromString() method
=========================================

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

 The **`addFromString()`** method of the
 `SpeechGrammarList` interface takes a grammar present in a specific
 string within the code base (e.g. stored in a variable) and adds it to
 the `SpeechGrammarList` as a new `SpeechGrammar` object.

Syntax
------


```js
addFromString(string)
addFromString(string, weight)
```

### Parameters

`string`

A string representing the grammar to be added.

`weight` Optional

 A float representing the weight of the grammar relative to other grammars present in
 the `SpeechGrammarList`. The weight means the importance of this grammar,
 or the likelihood that it will be recognized by the speech recognition service. The
 value can be between `0.0` and `1.0`; If not specified, the
 default used is `1.0`.


### Return value

None (`undefined`).

Examples
--------


```js
const grammar =
  "#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;";
const recognition = new SpeechRecognition();
const speechRecognitionList = new SpeechGrammarList();
speechRecognitionList.addFromString(grammar, 1);
recognition.grammars = speechRecognitionList;
```

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

| Specification |
| --- |
| Web Speech API # dom-speechgrammarlist-addfromstring |

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

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

See also
--------

* Web Speech API
LaunchQueue: setConsumer() method
=================================

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

The **`setConsumer()`** method of the `LaunchQueue` interface is used to declare the callback that will handle custom launch navigation handling in a progressive web app (PWA). Such custom navigation is initiated via `Window.launchQueue` when a PWA has been launched with a `launch_handler` `client_mode` value of `focus-existing`, `navigate-new`, or `navigate-existing`.

Syntax
------


```js
setConsumer(callback)
```

### Parameters

`callback`

A callback function that handles custom navigation for the PWA. The callback is passed a `LaunchParams` object instance as a parameter.

### Return value

`undefined`.

Examples
--------


```js
if ("launchQueue" in window) {
  window.launchQueue.setConsumer((launchParams) => {
    if (launchParams.targetURL) {
      const params = new URL(launchParams.targetURL).searchParams;

      // Assuming a music player app that gets a track passed to it to be played
      const track = params.get("track");
      if (track) {
        audio.src = track;
        title.textContent = new URL(track).pathname.substr(1);
        audio.play();
      }
    }
  });
}
```

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

| Specification |
| --- |
| Web App Launch Handler API # dom-launchqueue-setconsumer |

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

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

See also
--------

* Launch Handler API: Control how your app is launched
* `Window.launchQueue`
* Musicr 2.0 demo app
RTCIceParameters: password property
===================================

 The **`RTCIceParameters`**
 dictionary's **`password`** property specifies the ICE
 password that, in tandem with the `usernameFragment`, uniquely identifies an ICE session for its entire
 duration.

Value
-----

 A string containing the password that corresponds to the transport's
 `usernameFragment` string

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

#### No specification found

No specification data found for `api.RTCIceParameters.password`.  
Check for problems with this page or contribute a missing `spec_url` to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

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

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

 The **`RTCIceParameters`** dictionary's
 **`usernameFragment`** property specifies the username fragment
 ("ufrag") that uniquely identifies the corresponding ICE session for the duration of the
 current ICE session.

Value
-----

 A string containing the username fragment that, in tandem with the
 `password`, uniquely identify the ICE session
 being used by the transport. The string may be up to 256 characters long.

 See `RTCIceCandidate.usernameFragment` to learn more about username
 fragments and their role in a connection.

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

#### No specification found

No specification data found for `api.RTCIceParameters.usernameFragment`.  
Check for problems with this page or contribute a missing `spec_url` to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

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

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

 The
 **`OffscreenCanvasRenderingContext2D.commit()`**
 method of the Canvas 2D API copies the rendering context's bitmap to the bitmap of the placeholder `<canvas>` element of the associated `OffscreenCanvas` object.
 The copy operation is synchronous. Calling this method is not needed for the transfer, since it happens automatically during the event-loop execution.

Syntax
------


```js
commit()
```

Examples
--------


```js
const placeholder = document.createElement("canvas");
const offscreen = placeholder.transferControlToOffscreen();
const ctx = offscreenCanvas.getContext("2d");

// Perform some drawing using the 2d context
ctx.fillStyle = "blue";
ctx.fillRect(0, 0, 10, 10);

// Push placeholder to the canvas element
ctx.commit();
```

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

| Specification |
| --- |
| HTML Standard # offscreencontext2d-commit |

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

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

See also
--------

* The interface defining this method: `OffscreenCanvasRenderingContext2D`
Headers: delete() method
========================

 The **`delete()`** method of the `Headers`
 interface deletes a header from the current `Headers` object.

This method throws a `TypeError` for the following reasons:

* The value of the name parameter is not the name of an HTTP header.
* The value of Guard is `immutable`.

 For security reasons, some headers can only be controlled by the user agent. These
 headers include the forbidden header names
 and forbidden response header names.

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

Syntax
------


```js
delete(name)
```

### Parameters

`name`

The name of the HTTP header you want to delete from the `Headers` object.

### Return value

None (`undefined`).

Examples
--------

Creating an empty `Headers` object is simple:


```js
const myHeaders = new Headers(); // Currently empty
```


You could add a header to this using `Headers.append`:


```js
myHeaders.append("Content-Type", "image/jpeg");
myHeaders.get("Content-Type"); // Returns 'image/jpeg'
```


You can then delete it again:


```js
myHeaders.delete("Content-Type");
myHeaders.get("Content-Type"); // Returns null, as it has been deleted
```

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

| Specification |
| --- |
| Fetch Standard # ref-for-dom-headers-delete① |

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

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

See also
--------

* ServiceWorker API
* HTTP access control (CORS)
* HTTP
Headers: entries() method
=========================

 The **`Headers.entries()`** method returns an
 `iterator` allowing to go through all key/value pairs
 contained in this object. Both the key and value of each pair are
 `String` objects.

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

Syntax
------


```js
entries()
```

### Parameters

None.

### Return value

Returns an `iterator`.

Examples
--------


```js
// Create a test Headers object
const myHeaders = new Headers();
myHeaders.append("Content-Type", "text/xml");
myHeaders.append("Vary", "Accept-Language");

// Display the key/value pairs
for (const pair of myHeaders.entries()) {
  console.log(`${pair[0]}: ${pair[1]}`);
}
```


The result is:
```

content-type: text/xml
vary: Accept-Language
```

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

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

See also
--------

* ServiceWorker API
* HTTP access control (CORS)
* HTTP
Headers: Headers() constructor
==============================

 The **`Headers()`** constructor creates a new
 `Headers` object.

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

Syntax
------


```js
new Headers()
new Headers(init)
```

### Parameters

`init` Optional

 An object containing any HTTP headers
 that you want to pre-populate your `Headers` object with. This can be a
 simple object literal with `String` values, an array of name-value pairs, where each pair is a 2-element string array; or an existing
 `Headers` object. In the last case, the new `Headers` object
 copies its data from the existing `Headers` object.


Examples
--------

Creating an empty `Headers` object is simple:


```js
const myHeaders = new Headers(); // Currently empty
```


You could add a header to this using `Headers.append`:


```js
myHeaders.append("Content-Type", "image/jpeg");
myHeaders.get("Content-Type"); // Returns 'image/jpeg'
```


 Or you can add the headers you want as the `Headers` object is created. In
 the following snippet we create a new `Headers` object, adding some headers
 by passing the constructor an init object as an argument:


```js
const httpHeaders = {
  "Content-Type": "image/jpeg",
  "X-My-Custom-Header": "Zeke are cool",
};
const myHeaders = new Headers(httpHeaders);
```


 You can now create another `Headers` object, passing it the first
 `Headers` object as its init object:


```js
const secondHeadersObj = new Headers(myHeaders);
secondHeadersObj.get("Content-Type"); // Would return 'image/jpeg' — it inherits it from the first headers object
```


 You can also add the headers you want as the `Headers` object is created by using a two-dimensional array to add multiple headers with the same values. In
 the following snippet we create a new `Headers` object with multiple `Set-Cookie` headers
 by passing the constructor an init array as an argument:


```js
const headers = [
  ["Set-Cookie", "greeting=hello"],
  ["Set-Cookie", "name=world"],
];
const myHeaders = new Headers(headers);
```

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

| Specification |
| --- |
| Fetch Standard # ref-for-dom-headers① |

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

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

See also
--------

* ServiceWorker API
* HTTP access control (CORS)
* HTTP
Headers: has() method
=====================

 The **`has()`** method of the `Headers` interface
 returns a boolean stating whether a `Headers` object contains a certain
 header.

 For security reasons, some headers can only be controlled by the user agent. These
 headers include the forbidden header names
 and forbidden response header names.

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

Syntax
------


```js
has(name)
```

### Parameters

`name`

 The name of the HTTP header you want to test for. If the given name is not a valid
 HTTP header name, this method throws a `TypeError`.


### Return value

A boolean value.

Examples
--------

Creating an empty `Headers` object is simple:


```js
const myHeaders = new Headers(); // Currently empty
```


 You could add a header to this using `Headers.append`, then test for the
 existence of it using `has()`:


```js
myHeaders.append("Content-Type", "image/jpeg");
myHeaders.has("Content-Type"); // Returns true
myHeaders.has("Accept-Encoding"); // Returns false
```

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

| Specification |
| --- |
| Fetch Standard # ref-for-dom-headers-has① |

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

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

See also
--------

* ServiceWorker API
* HTTP access control (CORS)
* HTTP