recursal/MDN huggingface dataset:
FileSystemHandle: kind property
===============================

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

 The **`kind`** read-only property of the
 `FileSystemHandle` interface returns the type of entry. This is
 `'file'` if the associated entry is a file or `'directory'`. It is
 used to distinguish files from directories when iterating over the contents of a
 directory.

Value
-----

A string that can be:

* `'file'`: If the handle is a `FileSystemFileHandle`.
* `'directory'`: If the handle is a `FileSystemDirectoryHandle`.
Examples
--------

 The following function allows the user to choose a file from the file picker and then
 tests to see whether the handle returned is a file or directory


```js
// store a reference to our file handle
let fileHandle;

async function getFile() {
  // open file picker
  [fileHandle] = await window.showOpenFilePicker();

  if (fileHandle.kind === "file") {
    // run file code
  } else if (fileHandle.kind === "directory") {
    // run directory code
  }
}
```

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

| Specification |
| --- |
| File System Standard # ref-for-dom-filesystemhandle-kind① |

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

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

See also
--------

* File System API
* The File System Access API: simplifying access to local files
FileSystemHandle: queryPermission() method
==========================================

**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 **`queryPermission()`** method of the
 `FileSystemHandle` interface queries the current permission state of the
 current handle.

Syntax
------


```js
queryPermission(fileSystemHandlePermissionDescriptor)
```

### Parameters

FileSystemHandlePermissionDescriptor Optional

An object which specifies the permission mode to query for. Options are as follows:

* `'mode'`: Can be either `'read'` or
 `'readwrite'`.

### Return value

A `Promise` that resolves to a `PermissionStatus` object.

 If `PermissionStatus.state` returns "prompt" the website will have to call requestPermission() before any
 operations on the handle can be done. If this returns "denied" any operations will
 reject. Usually handles returned by the local file system handle factories will
 initially return "granted" for their read permission state. However, other than through
 the user revoking permission, a handle retrieved from IndexedDB is also likely to return
 "prompt".

### Exceptions

`TypeError`

 Thrown if `mode` is specified with a value other than
 `'read'` or `'readwrite'`

Examples
--------

 The following asynchronous function returns true if user has granted read or readwrite
 permissions to the file handle. Permission is requested if not.


```js
// fileHandle is a FileSystemFileHandle
// withWrite is a boolean set to true if write

async function verifyPermission(fileHandle, withWrite) {
  const opts = {};
  if (withWrite) {
    opts.mode = "readwrite";
  }

  // Check if we already have permission, if so, return true.
  if ((await fileHandle.queryPermission(opts)) === "granted") {
    return true;
  }

  // Request permission to the file, if the user grants permission, return true.
  if ((await fileHandle.requestPermission(opts)) === "granted") {
    return true;
  }

  // The user did not grant permission, return false.
  return false;
}
```

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

| Specification |
| --- |
| File System Access # api-filesystemhandle-querypermission |

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

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

See also
--------

* File System API
* The File System Access API: simplifying access to local files
FileSystemHandle: isSameEntry() method
======================================

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

 The **`isSameEntry()`** method of the
 `FileSystemHandle` interface compares two `handles` to see if the associated entries (either a file or directory) match.

Syntax
------


```js
isSameEntry(fileSystemHandle)
```

### Parameters

`FileSystemHandle`

 The `FileSystemHandle` to match against the handle on which the method is
 invoked.


### Return value

A Promise that fulfills with a `Boolean`.

Examples
--------

 The following function compares a single entry with an array of entries, and returns a
 new array with any matching entries removed.


```js
function removeMatches(fileEntry, entriesArr) {
  let newArr = entriesArr.filter((entry) => !fileEntry.isSameEntry(entry));

  return newArr;
}
```

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

| Specification |
| --- |
| File System Standard # api-filesystemhandle-issameentry |

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

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

See also
--------

* File System API
* The File System Access API: simplifying access to local files
HTMLTemplateElement: content property
=====================================

 The **`HTMLTemplateElement.content`** property returns a
 `<template>` element's template contents (a
 `DocumentFragment`).

Value
-----

A `DocumentFragment`.

Examples
--------


```js
const templateElement = document.querySelector("#foo");
const documentFragment = templateElement.content.cloneNode(true);
```

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

| Specification |
| --- |
| HTML Standard # dom-template-content-dev |

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

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

See also
--------

* `HTMLTemplateElement`
GPUExternalTexture: label property
==================================

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

 The **`label`** property of the
 `GPUExternalTexture` interface provides a label that can be used to identify the object, for example in `GPUError` messages or console warnings.

This can be set by providing a `label` property in the descriptor object passed into the originating `GPUDevice.importExternalTexture()` call, or you can get and set it directly on the `GPUExternalTexture` object.

Value
-----

A string. If this has not been previously set as described above, it will be an empty string.

Examples
--------

Setting and getting a label via `GPUExternalTexture.label`:


```js
// ...

const externalTexture = device.importExternalTexture({
  source: video,
});

externalTexture.label = "myExtTexture";

console.log(externalTexture.label); // "myExtTexture"
```


Setting a label via the originating `GPUDevice.importExternalTexture()` call, and then getting it via `GPUExternalTexture.label`:


```js
// ...

const externalTexture = device.importExternalTexture({
  source: video,
  label: "myExtTexture",
});

console.log(externalTexture.label); // "myExtTexture"
```

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

| Specification |
| --- |
| WebGPU # dom-gpuobjectbase-label |

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

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

See also
--------

* The WebGPU API
AudioDecoder: dequeue event
===========================

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 **`dequeue`** event of the `AudioDecoder` interface fires to signal a decrease in `AudioDecoder.decodeQueueSize`.

This eliminates the need for developers to use a `setTimeout()` poll to determine when the queue has decreased, and more work should be queued up.

Syntax
------

Use the event name in methods like `addEventListener()`, or set an event handler property.


```js
addEventListener("dequeue", (event) => {});

ondequeue = (event) => {};
```

Example
-------


```js
audioDecoder.addEventListener("dequeue", (event) => {
  // Queue up more decoding work
});
```

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

| Specification |
| --- |
| WebCodecs # eventdef-audiodecoder-dequeue |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
AudioDecoder: 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 `AudioDecoder` interface enqueues a control message to decode a given chunk of audio.

Syntax
------


```js
decode(chunk)
```

### Parameters

`chunk`

An `EncodedAudioChunk` object representing a chunk of encoded audio.

### Return value

None (`undefined`).

### Exceptions

`InvalidStateError` `DOMException`

Thrown if the `state` is not `"configured"`.

`DataError` `DOMException`

Thrown if the `chunk` is unable to be decoded due to relying on other frames for decoding.

Examples
--------

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

| Specification |
| --- |
| WebCodecs # dom-audiodecoder-decode |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
AudioDecoder: flush() 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 **`flush()`** method of the `AudioDecoder` interface returns a Promise that resolves once all pending messages in the queue have been completed.

Syntax
------


```js
flush()
```

### Parameters

None.

### Return value

A `Promise` that resolves with undefined.

### Exceptions

If an error occurs, the promise will resolve with one of the following exceptions:

`InvalidStateError` `DOMException`

Returned if the Promise is rejected because the `state` is not `configured`.

Examples
--------

The following example flushes the `AudioDecoder`.


```js
await audioDecoder.flush();
```

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

| Specification |
| --- |
| WebCodecs # dom-audiodecoder-flush |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
AudioDecoder: AudioDecoder() 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 **`AudioDecoder()`** constructor creates a new `AudioDecoder` object with the provided `init.output` callback assigned as the output callback, the provided `init.error` callback as the error callback, and the `AudioDecoder.state` set to `"unconfigured"`.

Syntax
------


```js
new AudioDecoder(init)
```

### Parameters

`init`

A dictionary object containing two required callbacks.

`output`

A callback which is passed a single argument of an `AudioData` object.

`error`

A callback which is passed a single argument of the error that has been thrown.


Examples
--------

In the following example an `AudioDecoder` is created with the two required callback functions, one to deal with the decoded chunk and the other to handle errors.


```js
const audioDecoder = new AudioDecoder({
  output: processAudio,
  error: onEncoderError,
});
```

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

| Specification |
| --- |
| WebCodecs # audiodecoder |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
AudioDecoder: isConfigSupported() 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 **`isConfigSupported()`** static method of the `AudioDecoder` interface checks if the given config is supported (that is, if `AudioDecoder` objects can be successfully configured with the given config).

Syntax
------


```js
AudioDecoder.isConfigSupported(config)
```

### Parameters

`config`

The dictionary object accepted by `AudioDecoder.configure`

### Return value

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

`supported`

A boolean value which is `true` if the given config is supported by the decoder.

`config`

A copy of the given config with all the fields recognized by the decoder.

### Exceptions

`TypeError`

Thrown if the provided `config` is invalid; that is, if doesn't have required values (such as an empty `codec` field) or has invalid values (such as a negative `sampleRate`).

Examples
--------

The following example tests if the browser supports several audio codecs.


```js
const codecs = ["mp4a.40.2", "mp3", "alaw", "ulaw"];
const configs = [];
for (const codec of codecs) {
  configs.push({
    codec,
    sampleRate: 48000,
    numberOfChannels: 1,
    not\_supported\_field: 123,
  });
}
for (const config of configs) {
  const support = await AudioDecoder.isConfigSupported(config);
  console.log(
    `AudioDecoder's config ${JSON.stringify(support.config)} support: ${
 support.supported
 }`,
  );
}
```

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

| Specification |
| --- |
| WebCodecs # dom-audiodecoder-isconfigsupported |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
AudioDecoder: decodeQueueSize 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 **`decodeQueueSize`** read-only property of the `AudioDecoder` interface returns the number of pending decode requests in the queue.

Value
-----

An integer containing the number of requests.

Examples
--------

The following example prints the size of the queue to the console.


```js
console.log(AudioDecoder.decodeQueueSize);
```

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

| Specification |
| --- |
| WebCodecs # dom-audiodecoder-decodequeuesize |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
AudioDecoder: 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 `AudioDecoder` interface ends all pending work and releases system resources.

Syntax
------


```js
close()
```

### Parameters

None.

### Return value

None (`undefined`).

Examples
--------

The following example closes the `AudioDecoder`.


```js
AudioDecoder.close();
```

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

| Specification |
| --- |
| WebCodecs # dom-audiodecoder-close |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
AudioDecoder: configure() 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 **`configure()`** method of the `AudioDecoder` interface enqueues a control message to configure the audio decoder for decoding chunks.

Syntax
------


```js
configure(config)
```

### Parameters

`config`

A dictionary object containing the following members:

`codec`

A string containing a valid codec string. See "codecs" parameter for details on codec string construction.

`sampleRate`

An integer representing the number of frame samples per second.

`numberOfChannels`

An integer representing the number of audio channels.

`description` Optional

An `ArrayBuffer`, a `TypedArray`, or a `DataView` containing a sequence of codec specific bytes, commonly known as extradata.


**Note:** The registrations in the WebCodecs Codec Registry link to a specification detailing whether and how to populate the optional `description` member.

### Return value

None (`undefined`).

### Exceptions

`TypeError`

Thrown if the provided `config` is invalid.

`InvalidStateError` `DOMException`

Thrown if the `state` is `"closed"`.

`NotSupportedError` `DOMException`

Thrown if the provided `config` is valid but the user agent cannot provide a codec that can decode this profile.

Examples
--------

The following example configures the `audioDecoder` with the `opus` codec.


```js
audioDecoder.configure({
  codec: "opus",
  sampleRate: 44100,
  numberOfChannels: 2,
});
```

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

| Specification |
| --- |
| WebCodecs # dom-audiodecoder-configure |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
AudioDecoder: state 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 **`state`** read-only property of the `AudioDecoder` interface returns the current state of the underlying codec.

Value
-----

A string containing one of the following values:

`"unconfigured"`

The codec is not configured for decoding.

`"configured"`

The codec has a valid configuration and is ready.

`"closed"`

The codec is no longer usable and system resources have been released.

Examples
--------

The following example prints the state of the `AudioDecoder` to the console.


```js
console.log(AudioDecoder.state);
```

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

| Specification |
| --- |
| WebCodecs # dom-audiodecoder-state |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
AudioDecoder: 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 `AudioDecoder` interface resets all states including configuration, control messages in the control message queue, and all pending callbacks.

Syntax
------


```js
reset()
```

### Parameters

None.

### Return value

None (`undefined`).

Examples
--------

The following example resets the `AudioDecoder`.


```js
AudioDecoder.reset();
```

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

| Specification |
| --- |
| WebCodecs # dom-audiodecoder-reset |

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

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

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

 The **`label`** property of the
 `GPUShaderModule` interface provides a label that can be used to identify the object, for example in `GPUError` messages or console warnings.

This can be set by providing a `label` property in the descriptor object passed into the originating `GPUDevice.createShaderModule()` call, or you can get and set it directly on the `GPUShaderModule` object.

Value
-----

A string. If this has not been previously set as described above, it will be an empty string.

Examples
--------

Setting and getting a label via `GPUShaderModule.label`:


```js
// ...

const shaderModule = device.createShaderModule({
  code: shaders,
});

shaderModule.label = "myshader";

console.log(shaderModule.label); // "myshader"
```


Setting a label via the originating `GPUDevice.createShaderModule()` call, and then getting it via `GPUShaderModule.label`:


```js
// ...

const shaderModule = device.createShaderModule({
  code: shaders,
  label: "myshader",
});

console.log(shaderModule.label); // "myshader"
```

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

| Specification |
| --- |
| WebGPU # dom-gpuobjectbase-label |

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

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

See also
--------

* The WebGPU API