recursal/MDN huggingface dataset:
SharedStorage: append() method
==============================

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

The **`append()`** method of the `SharedStorage` interface appends a string to the value of an existing key-value pair in the current origin's shared storage.

Syntax
------


```js
append(key, value)
```

### Parameters

`key`

A string representing the key of the key-value pair to which you want to append a value.

`value`

A string that you want to append to the existing value of the key-value pair.


**Note:** If the specified `key` isn't found in the shared storage, the `append()` operation is equivalent to `set()`, that is, a new key-value pair with the specified `key` is added to the shared storage.

### Return value

A `Promise` that fulfills with `undefined`.

### Exceptions

* The `Promise` rejects with a `TypeError` if:
    + The appended entry was not successfully stored in the database due to shared storage not being available (for example it is disabled using a browser setting).
    + `key` and/or `value` exceed the browser-defined maximum length.
    + The calling site does not have the Shared Storage API included in a successful privacy sandbox enrollment process.
* In the case of `WorkletSharedStorage`, the `Promise` rejects with a `TypeError` if the worklet module has not been added with `SharedStorageWorklet.addModule()`.

**Note:** In the case of `WindowSharedStorage`, if the `append()` operation doesn't successfully write to the database for a reason other than shared storage not being available, no error is thrown — the operation still fulfills with `undefined`.

Examples
--------


```js
window.sharedStorage
  .append("integer-list", ",9")
  .then(console.log("Value appended to integer list"));
```

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

| Specification |
| --- |
| Shared Storage API # dom-sharedstorage-append |

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

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

See also
--------

* Shared Storage API
SharedStorage: delete() method
==============================

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

The **`delete()`** method of the `SharedStorage` interface deletes an existing key-value pair from the current origin's shared storage.

Syntax
------


```js
delete(key)
```

### Parameters

`key`

A string representing the key of the key-value pair you want to delete.

### Return value

A `Promise` that fulfills with `undefined`.

### Exceptions

* The `Promise` rejects with a `TypeError` if:
    + The database was not cleared successfully due to shared storage not being available (for example it is disabled using a browser setting).
    + `key` exceeds the browser-defined maximum length.
    + The calling site does not have the Shared Storage API included in a successful privacy sandbox enrollment process.
* In the case of `WorkletSharedStorage`, the `Promise` rejects with a `TypeError` if:
    + The worklet module has not been added with `SharedStorageWorklet.addModule()`.

**Note:** If the key-value pair doesn't exist in the shared storage, no error is thrown — the operation still fulfills with `undefined`.

**Note:** In the case of `WindowSharedStorage`, if the `delete()` operation doesn't successfully write to the database for a reason other than shared storage not being available, no error is thrown — the operation still fulfills with `undefined`.

Examples
--------


```js
window.sharedStorage
  .delete("ab-testing-group")
  .then(console.log("Value deleted"));
```

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

| Specification |
| --- |
| Shared Storage API # dom-sharedstorage-delete |

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

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

See also
--------

* Shared Storage API
SharedStorage: set() method
===========================

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

The **`set()`** method of the `SharedStorage` interface either stores a new key-value pair in the current origin's shared storage or updates an existing one.

Syntax
------


```js
set(key, value)
set(key, value, options)
```

### Parameters

`key`

A string representing the key in the key-value pair that you want to add or update.

`value`

A string representing the value you want to add or update.

`options` Optional

An options object containing the following properties:

`ignoreIfPresent`

A boolean value. The value `true` causes the set operation to abort if a key-value pair with the specified `key` already exists. The default value `false` causes the set operation to overwrite the previous value.


### Return value

A `Promise` that fulfills with `undefined`.

### Exceptions

* The `Promise` rejects with a `TypeError` if:
    + The created entry was not successfully stored in the database due to shared storage not being available (for example it is disabled using a browser setting).
    + `key` and/or `value` exceed the browser-defined maximum length.
    + The calling site does not have the Shared Storage API included in a successful privacy sandbox enrollment process.
* In the case of `WorkletSharedStorage`, the `Promise` rejects with a `TypeError` if the worklet module has not been added with `SharedStorageWorklet.addModule()`.

**Note:** In the case of `WindowSharedStorage`, if the `set()` operation doesn't successfully write to the database for a reason other than shared storage not being available, no error is thrown — the operation still fulfills with `undefined`.

Examples
--------


```js
window.sharedStorage
  .set("ab-testing-group", "0", {
    ignoreIfPresent: true,
  })
  .then(console.log("Set operation completed"));
```

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

| Specification |
| --- |
| Shared Storage API # dom-sharedstorage-set |

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

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

See also
--------

* Shared Storage API
StorageEvent: key property
==========================

The **`key`** property of the `StorageEvent` interface returns the key for the storage item that was changed.

Value
-----

A string containing the key for the storage item that was changed.

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

| Specification |
| --- |
| HTML Standard # dom-storageevent-key-dev |

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

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

See also
--------

* Web Storage API
StorageEvent: url property
==========================

The **`url`** property of the `StorageEvent` interface returns the URL of the document whose storage changed.

Value
-----

A string containing the URL of the document whose storage changed.

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

| Specification |
| --- |
| HTML Standard # dom-storageevent-url-dev |

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

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

See also
--------

* Web Storage API
StorageEvent: StorageEvent() constructor
========================================

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

Syntax
------


```js
new StorageEvent(type)
new StorageEvent(type, options)
```

### Parameters

`type`

A string with the name of the type of the `StorageEvent`. It is case-sensitive and browsers set it to `storage`.

`options` Optional

An object that, *in addition of the properties defined in `Event()`*, has the following properties:

`key` Optional

A string that represents the key for the storage item that changed. Defaults to `null`.

`oldValue` Optional

A string containing the original value of the storage item. Defaults to `null`.

`newValue` Optional

A string with the new value of the `key`. Defaults to `null`.

`url`

A string with the URL of the document whose storage changed.

`storageArea` Optional

A `Storage` object that represents the storage that was affected. Defaults to `null`.


### Return value

A new `StorageEvent` object.

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

#### No specification found

No specification data found for `api.StorageEvent.StorageEvent`.  
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.

See also
--------

* Web Storage API
StorageEvent: newValue property
===============================

The **`newValue`** property of the `StorageEvent` interface returns the new value of the storage item whose value was changed.

Value
-----

A string containing the new value of the storage item.

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

| Specification |
| --- |
| HTML Standard # dom-storageevent-newvalue-dev |

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

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

See also
--------

* Web Storage API
StorageEvent: storageArea property
==================================

The **`storageArea`** property of the `StorageEvent` interface returns the storage object that was affected.

Value
-----

A `Storage` object that represents the storage object that was affected.

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

| Specification |
| --- |
| HTML Standard # dom-storageevent-storagearea-dev |

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

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

See also
--------

* Web Storage API
StorageEvent: oldValue property
===============================

The **`oldValue`** property of the `StorageEvent` interface returns the original value of the storage item whose value changed.

Value
-----

A string containing the original value of the storage item.

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

| Specification |
| --- |
| HTML Standard # dom-storageevent-oldvalue-dev |

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

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

See also
--------

* Web Storage API
StorageEvent: initStorageEvent() method
=======================================

**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

The **`StorageEvent.initStorageEvent()`** method is used to initialize the value of a `StorageEvent`.

Syntax
------


```js
initStorageEvent(type)
initStorageEvent(type, canBubble)
initStorageEvent(type, canBubble, cancelable)
initStorageEvent(type, canBubble, cancelable, key)
initStorageEvent(type, canBubble, cancelable, key, oldValue)
initStorageEvent(type, canBubble, cancelable, key, oldValue, newValue)
initStorageEvent(type, canBubble, cancelable, key, oldValue, newValue, url)
initStorageEvent(type, canBubble, cancelable, key, oldValue, newValue, url, storageArea)
```

### Parameters

`typeArg`

The name of the event.

`canBubble` Optional

A boolean indicating whether the event bubbles up through the DOM or not.

`cancelable` Optional

A boolean indicating whether the event is cancelable.

`key` Optional

The key whose value is changing as a result of this event.

`oldValue` Optional

The key's old value.

`newValue` Optional

The key's new value.

`url` Optional

The URL of the document initiating the change.

`storageArea` Optional

The `Storage` object representing the storage area on which this event occurred.

### Return value

None (`undefined`).

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

| Specification |
| --- |
| HTML Standard # dom-storageevent-initstorageevent |

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

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

See also
--------

* Web Storage API
* The constructor to use instead of this deprecated method: `StorageEvent()`.
ChannelSplitterNode: ChannelSplitterNode() constructor
======================================================

The **`ChannelSplitterNode()`** constructor of the Web Audio API creates a new `ChannelSplitterNode` object instance, representing a node that splits the input into a separate output for each of the source node's audio channels.

Syntax
------


```js
new ChannelSplitterNode(context)
new ChannelSplitterNode(context, options)
```

### Parameters

`context`

A `BaseAudioContext` representing the audio context you want the node to be associated with.

`options` Optional

An object defining the properties you want the `ChannelSplitterNode` to have:

`numberOfOutputs` Optional

A number defining the number of outputs the `ChannelSplitterNode` should have. If not specified, the default value used is 6.

`channelCount` Optional

 An integer used to determine how many channels are used when up-mixing and down-mixing connections to any inputs to the node.
 (See `AudioNode.channelCount` for more information.)
 Its usage and precise definition depend on the value of `channelCountMode`.


`channelCountMode` Optional

 A string describing the way channels must be matched between the node's inputs and outputs.
 (See `AudioNode.channelCountMode` for more information including default values.)


`channelInterpretation` Optional

 A string describing the meaning of the channels.
 This interpretation will define how audio up-mixing and down-mixing will happen.
 The possible values are `"speakers"` or `"discrete"`.
 (See `AudioNode.channelCountMode` for more information including default values.)



### Return value

A new `ChannelSplitterNode` object instance.

Examples
--------


```js
const ac = new AudioContext();

const options = {
  numberOfOutputs: 2,
};

const mySplitter = new ChannelSplitterNode(ac, options);
```

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

| Specification |
| --- |
| Web Audio API # dom-channelsplitternode-constructor-channelsplitternode |

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

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

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

**Note:** A web developer doesn't typically need to call this constructor, as the browser creates these objects itself when firing `popstate` events.

Syntax
------


```js
new PopStateEvent(type, options)
```

### Parameters

`type`

 A string with the name of the event.
 It is case-sensitive and browsers set it to `popstate`.


`options` Optional

An object that, *in addition to the properties defined in `Event()`*, has the following property:

`state` Optional

An object representing the state. Practically it is a value provided by the call to `history.pushState()` or `history.replaceState()`. If not set, it defaults to `null`.


### Return value

A new `PopStateEvent` object.

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

| Specification |
| --- |
| HTML Standard # the-popstateevent-interface |

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

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

See also
--------

* `history.pushState()`
* `history.replaceState()`
* `popstate` event
PopStateEvent: state property
=============================

The **`state`** read-only property of the `PopStateEvent` interface represents the state stored when the event was created.

Practically it is a value provided by the call to `history.pushState()` or `history.replaceState()`

Value
-----

An object, or `null`.

Examples
--------

 The code below logs the value of `state` when using the
 `pushState()` method to push a value to the history.


```js
// Log the state of
addEventListener("popstate", (event) => {
  console.log("State received: ", event.state);
});

// Now push something on the stack
history.pushState({ name: "Example" }, "pushState example", "page1.html");
history.pushState(
  { name: "Another example" },
  "pushState example",
  "page1.html",
);
```


This will log:
```

State received: { name: "Example" }
State received: { name: "Another example" }
```

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

| Specification |
| --- |
| HTML Standard # dom-popstateevent-state-dev |

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

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

See also
--------

* `PopStateEvent()` constructor
* `History.state`
AudioTrack: kind property
=========================

 The **`kind`** property contains a
 string indicating the category of audio contained in the
 **`AudioTrack`**.

 The `kind` can be used
 to determine the scenarios in which specific tracks should be enabled or disabled. See
 Audio track kind strings for a list of the kinds available for audio tracks.

Value
-----

 A string specifying the type of content the media represents. The
 string is one of those found in Audio track kind strings below.

Audio track kind strings
------------------------

The kinds available for audio tracks are:

`"alternative"`

 A potential alternative to the main track, such as a different audio take or a
 version of the soundtrack with only the music and no dialogue.


`"descriptions"`

 An audio track providing audible descriptions of the action depicted in a video
 track.


`"main"`

The primary audio track.

`"main-desc"`

The primary audio track with audio descriptions mixed into it.

`"translation"`

A translated version of the primary audio track.

`"commentary"`

 An audio track containing a commentary. This might be used to contain the director's
 commentary track on a movie, for example.


`""` (empty string)

 The track doesn't have an explicit kind, or the kind provided by the track's
 metadata isn't recognized by the user agent.


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

| Specification |
| --- |
| HTML Standard # dom-audiotrack-kind-dev |

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

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

 The read-only **`AudioTrack`**
 property **`language`** returns a string identifying the
 language used in the audio track.

 For tracks that include multiple languages
 (such as a movie in English in which a few lines are spoken in other languages), this
 should be the video's primary language.

Value
-----

 A string specifying the BCP 47 (RFC 5646) format language tag of
 the primary language used in the audio track, or an empty string (`""`) if
 the language is not specified or known, or if the track doesn't contain speech.

 For example, if the primary language used in the track is United States English, this
 value would be `"en-US"`. For Brazilian Portuguese, the value would be
 `"pt-BR"`.

Examples
--------

 This example locates all of a media element's primary language and translated audio
 tracks and returns a list of objects containing each of those tracks'
 `id`, `kind`, and
 `language`.

 This could then be used to build a user interface for selecting the language the user
 would like to listen to while watching a movie, for example.


```js
function getAvailableLanguages(el) {
  const trackList = [];
  const wantedKinds = ["main", "translation"];

  el.audioTracks.forEach((track) => {
    if (wantedKinds.includes(track.kind)) {
      trackList.push({
        id: track.id,
        kind: track.kind,
        language: track.language,
      });
    }
  });
  return trackList;
}
```

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

| Specification |
| --- |
| HTML Standard # dom-audiotrack-language-dev |

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

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

 The read-only **`AudioTrack`**
 property **`label`** returns a string specifying the audio
 track's human-readable label, if one is available; otherwise, it returns an empty
 string.

Value
-----

 A string specifying the track's human-readable label, if one is
 available in the track metadata. Otherwise, an empty string (`""`) is
 returned.

 For example, a track whose `kind` is
 `"commentary"` might have a `label` such as
 `"Commentary with director Mark Markmarkimark and star Donna Donnalidon"`.

Examples
--------

 This example returns an array of track kinds and labels for potential use in a user
 interface to select audio tracks for a specified media element. The list is filtered to
 only allow certain track kinds through.


```js
function getTrackList(el) {
  const trackList = [];
  const wantedKinds = [
    "main",
    "alternative",
    "main-desc",
    "translation",
    "commentary",
  ];

  el.audioTracks.forEach((track) => {
    if (wantedKinds.includes(track.kind)) {
      trackList.push({
        id: track.id,
        kind: track.kind,
        label: track.label,
      });
    }
  });
  return trackList;
}
```


 The resulting `trackList` contains an array of audio tracks whose
 `kind` is one of those in the array `wantedKinds`, with each entry
 providing the track's `id`, `kind`, and `label`.

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

| Specification |
| --- |
| HTML Standard # dom-audiotrack-label-dev |

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

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

 The read-only **`AudioTrack`**
 property **`sourceBuffer`** returns the
 `SourceBuffer` that created the track, or null if the track was not
 created by a `SourceBuffer` or the `SourceBuffer` has been
 removed from the `MediaSource.sourceBuffers` attribute of its parent
 media source.

Value
-----

A `SourceBuffer` or null.

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

| Specification |
| --- |
| Media Source Extensions™ # dom-audiotrack-sourcebuffer |

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

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