recursal/MDN huggingface dataset:
WritableStream: abort() method
==============================

The **`abort()`** method of the `WritableStream` interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.

Syntax
------


```js
abort(reason)
```

### Parameters

`reason`

A string providing a human-readable reason for the abort.

### Return value

A `Promise`, which fulfills with the value given in the `reason` parameter.

### Exceptions

`TypeError`

The stream you are trying to abort is not a `WritableStream`, or it is locked.

Examples
--------


```js
const writableStream = new WritableStream(
  {
    write(chunk) {
      // ...
    },
    close() {
      // ...
    },
    abort(err) {
      // ...
    },
  },
  queuingStrategy,
);

// ...

// abort the stream later on, when required
writableStream.abort();
```

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

| Specification |
| --- |
| Streams Standard # ref-for-ws-abort③ |

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

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

The **`locked`** read-only property of the `WritableStream` interface returns a boolean indicating whether the `WritableStream` is locked to a writer.

Value
-----

A boolean value indicating whether or not the writable stream is locked.

Examples
--------


```js
const writableStream = new WritableStream(
  {
    write(chunk) {
      // ...
    },
    close() {
      // ...
    },
    abort(err) {
      // ...
    },
  },
  queuingStrategy,
);

// ...

const writer = writableStream.getWriter();

writableStream.locked;
// should return true, as the stream has been locked to a writer
```

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

| Specification |
| --- |
| Streams Standard # ref-for-ws-locked② |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
RTCDtlsTransport: error event
=============================

An `RTCDtlsTransport` receives an `error` event when a transport-level error occurs on the `RTCPeerConnection`.

This event is not cancelable and does not bubble.

Syntax
------

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


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

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

Event type
----------

An `RTCErrorEvent`. Inherits from `Event`.

Event

RTCErrorEventEvent properties
----------------

*In addition to the standard properties available on the `Event` interface, `RTCErrorEvent` also includes the following:*

`error` Read only 

An `RTCError` object specifying the error which occurred; this object includes the type of error that occurred, information about where the error occurred (such as which line number in the SDP or what SCTP cause code was at issue).

Description
-----------

Transport-level errors will have one of the following values for the specified error's `RTCError` property `errorDetail`:

`dtls-failure`

The negotiation of the DTLS connection failed, or the connection was terminated with a fatal error. The error's `message` contains details about the nature of the error. If a fatal error is *received*, the error object's `receivedAlert` property is set to the value of the DTLSL alert received. If, on the other hand, a fatal error was *sent*, the `sentAlert` is set to the alert's value.

`fingerprint-failure`

The remote certificate for the `RTCDtlsTransport` didn't match any of the fingerprints listed in the SDP. If the remote peer can't match the local certificate against the provided fingerprints, this error doesn't occur, though this situation may result instead in a `dtls-failure` error.

Examples
--------

In this example, the `onerror` event handler property is used to set the handler for the `error` event.


```js
transport.onerror = (ev) => {
  const err = ev.error;

  // …
};
```


**Note:** Since `RTCError` is not one of the legacy errors, the value of `code` is always 0.

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

#### No specification found

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

* WebRTC API
RTCDtlsTransport: iceTransport property
=======================================

 The read-only **`RTCDtlsTransport`**
 property **`iceTransport`** contains a reference
 to the underlying `RTCIceTransport`.

Value
-----

The underlying `RTCIceTransport` instance.

Examples
--------

TBD

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

| Specification |
| --- |
| WebRTC: Real-Time Communication in Browsers # dom-rtcdtlstransport-icetransport |

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

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

See also
--------

* `RTCDtlsTransport`
* `RTCIceTransport`
RTCDtlsTransport: state property
================================

 The **`state`** read-only property of the
 `RTCDtlsTransport` interface provides information which describes a
 Datagram Transport Layer Security (**DTLS**) transport state.

Value
-----

A string. Its value is one of the following:

`new`

The initial state when DTLS has not started negotiating yet.

`connecting`

DTLS is in the process of negotiating a secure connection and verifying the remote fingerprint.

`connected`

DTLS has completed negotiation of a secure connection and verified the remote fingerprint.

`closed`

 The transport has been closed intentionally as the result of receipt of a
 `close_notify` alert, or calling `RTCPeerConnection.close()`.


`failed`

 The transport has failed as the result of an error (such as receipt of an error
 alert or failure to validate the remote fingerprint).


Examples
--------

See `RTCDtlsTransport` for example code.

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

| Specification |
| --- |
| WebRTC: Real-Time Communication in Browsers # dom-rtcdtlstransport-state |

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

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

See also
--------

* WebRTC API
* `RTCDtlsTransport`
UserActivation: isActive property
=================================

The read-only **`isActive`** property of the `UserActivation` interface indicates whether the current window has transient user activation.

Value
-----

A boolean.

Examples
--------

### Checking if a user gesture was recently performed

Use the `isActive` property to check whether the user is currently interacting with the page.


```js
if (navigator.userActivation.isActive) {
  // proceed to request playing media, for example
}
```

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

| Specification |
| --- |
| HTML Standard # dom-useractivation-isactive |

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

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

See also
--------

* `UserActivation`
* `UserActivation.hasBeenActive`
* Features gated by user activation
UserActivation: hasBeenActive property
======================================

The read-only **`hasBeenActive`** property of the `UserActivation` interface indicates whether the current window has sticky user activation.

Value
-----

A boolean.

Examples
--------

### Checking if a user gesture was ever performed

Use the `hasBeenActive` property to check whether the user has interacted with the page since it was loaded.


```js
if (navigator.userActivation.hasBeenActive) {
  // proceed with auto-playing an animation, for example
}
```

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

| Specification |
| --- |
| HTML Standard # dom-useractivation-hasbeenactive |

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

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

See also
--------

* `UserActivation`
* `UserActivation.isActive`
* Features gated by user activation
PushEvent: data property
========================

The `data` read-only property of the **`PushEvent`** interface returns a reference to a `PushMessageData` object containing data sent to the `PushSubscription`.

Value
-----

A `PushMessageData` object or `null` if no `data` member is passed when the event instance initialized.

Examples
--------

The following example takes data from a PushEvent and displays it on all of the service workers' clients.


```js
self.addEventListener("push", (event) => {
  if (!(self.Notification && self.Notification.permission === "granted")) {
    return;
  }

  const data = event.data?.json() ?? {};
  const title = data.title || "Something Has Happened";
  const message =
    data.message || "Here's something you might want to check out.";
  const icon = "images/new-notification.png";

  const notification = new Notification(title, {
    body: message,
    tag: "simple-push-demo-notification",
    icon,
  });

  notification.addEventListener("click", () => {
    clients.openWindow(
      "https://example.blog.com/2015/03/04/something-new.html",
    );
  });
});
```

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

| Specification |
| --- |
| Push API # dom-pushevent-data |

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

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

 The **`PushEvent()`** constructor creates a new
 `PushEvent` object. Note that this constructor is exposed only to a
 service worker context.

Syntax
------


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

### Parameters

`type`

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


`options` Optional

An object that, *in addition of the properties defined in `ExtendableEvent()`*, can have the following properties:

`data`

 The data you want the `PushEvent` to contain, if any.
 When the constructor is invoked, the `PushEvent.data` property of the resulting object will be set
 to a new `PushMessageData` object containing these bytes.



### Return value

A new `PushEvent` object.

Examples
--------


```js
const dataInit = {
  data: "Some sample text",
};

const myPushEvent = new PushEvent("push", dataInit);

myPushEvent.data.text(); // should return 'Some sample text'
```

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

| Specification |
| --- |
| Push API # dom-pushevent-constructor |

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

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

See also
--------

* Push API
* Service Worker API
CSSRuleList: length property
============================

The **`length`** property of the `CSSRuleList` interface returns the number of `CSSRule` objects in the list.

Value
-----

An integer.

Examples
--------

In the following example the number of items in the `CSSRuleList` named `myRules` is printed to the console.


```js
let myRules = document.styleSheets[0].cssRules;
console.log(myRules.length);
```

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

| Specification |
| --- |
| CSS Object Model (CSSOM) # dom-cssrulelist-length |

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

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

The **`item()`** method of the `CSSRuleList` interface returns the `CSSRule` object at the specified `index` or `null` if the specified `index` doesn't exist.

Syntax
------


```js
item(index)
```

### Parameters

`index`

An integer.

### Return value

A `CSSRule`.

Examples
--------

In the following example, we assume that the `myRules` list has three items only.


```js
let myRules = document.styleSheets[0].cssRules;
console.log(myRules.item(0)); // Logs the first CSSRule item from this list

// Accessing non-existing items using this method will return null instead of undefined
console.log(myRules.item(5)); // null
console.log(myRules[5]); // undefined
```

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

| Specification |
| --- |
| CSS Object Model (CSSOM) # dom-cssrulelist-item |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
MIDIInput: midimessage event
============================

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

The `midimessage` event of the Web MIDI API is fired when the MIDI port corresponding to this `MIDIInput` finishes receiving one or more MIDI messages. An instance of `MIDIMessageEvent` containing the message that was received is passed to the event handler.

Syntax
------

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


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

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

Event type
----------

An `MIDIMessageEvent`. Inherits from `Event`.

Event

MIDIMessageEventEvent properties
----------------

*This interface also inherits properties from `Event`.*

`MIDIMessageEvent.data`

A `Uint8Array` containing the data bytes of a single MIDI message. See the MIDI specification for more information on its form.

Examples
--------

In the following example `midimessage` events are listened for on all input ports. When a message is received the `MIDIMessageEvent.data` property is printed to the console.


```js
inputs.forEach((input) => {
  input.onmidimessage = (message) => {
    console.log(message.data);
  };
});
```

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

| Specification |
| --- |
| Web MIDI API # dom-midiinput-onmidimessage |

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

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

 The `numberOfInputs` property of
 the `AudioNode` interface returns the number of inputs feeding the
 node. Source nodes are defined as nodes having a `numberOfInputs`
 property with a value of 0.

Value
-----

An integer ≥ 0.

Examples
--------


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

const oscillator = audioCtx.createOscillator();
const gainNode = audioCtx.createGain();

oscillator.connect(gainNode).connect(audioCtx.destination);

console.log(oscillator.numberOfInputs); // 0
console.log(gainNode.numberOfInputs); // 1
console.log(audioCtx.destination.numberOfInputs); // 1
```

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

| Specification |
| --- |
| Web Audio API # dom-audionode-numberofinputs |

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

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

See also
--------

* Using the Web Audio API
AudioNode: context property
===========================

 The read-only `context` property of the
 `AudioNode` interface returns the associated
 `BaseAudioContext`, that is the object representing the processing graph
 the node is participating in.

Value
-----

 The `AudioContext` or `OfflineAudioContext` object that was
 used to construct this `AudioNode`.

Examples
--------


```js
const AudioContext = window.AudioContext || window.webkitAudioContext;
const audioCtx = new AudioContext();

const oscillator = audioCtx.createOscillator();
const gainNode = audioCtx.createGain();
oscillator.connect(gainNode).connect(audioCtx.destination);

console.log(oscillator.context); // AudioContext
console.log(oscillator.context === audioCtx); // true
```

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

| Specification |
| --- |
| Web Audio API # dom-audionode-context |

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

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

See also
--------

* Using the Web Audio API
AudioNode: disconnect() method
==============================

The **`disconnect()`** method of the `AudioNode` interface lets you disconnect one or more nodes from the node on which the method is called.

Syntax
------


```js
disconnect()
```

### Parameters

There are several versions of the `disconnect()` method, which accept different combinations of parameters to control which nodes to disconnect from. If no parameters are provided, all outgoing connections are disconnected.

`destination` Optional

An `AudioNode` or `AudioParam` specifying the node or nodes to disconnect from. If this value is an `AudioNode`, a single node is disconnected from, with any other, optional, parameters (`output` and/or `input`) further limiting which inputs and/or outputs should be disconnected. If this value is an `AudioParam`, then the connection to that `AudioParam` is terminated, and the node's contributions to that computed parameter become 0 going forward once the change takes effect.

`output` Optional

An index describing which output from the current `AudioNode` is to be disconnected. The index numbers are defined according to the number of output channels (see Audio channels).

`input` Optional

An index describing which input into the specified destination `AudioNode` is to be disconnected. The index numbers are defined according to the number of input channels (see Audio channels).

### Return value

None (`undefined`).

### Exceptions

`IndexSizeError` `DOMException`

Thrown if the value specified as `input` or `output` is invalid, referring to a node which doesn't exist or is outside the permitted range.

`InvalidAccessError` `DOMException`

Thrown if the node on which `disconnect()` is called isn't connected to the specified `destination` node.

Examples
--------


```js
const AudioContext = window.AudioContext || window.webkitAudioContext;

const audioCtx = new AudioContext();

const oscillator = audioCtx.createOscillator();
const gainNode = audioCtx.createGain();

oscillator.connect(gainNode);
gainNode.connect(audioCtx.destination);

gainNode.disconnect();
```

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

| Specification |
| --- |
| Web Audio API # dom-audionode-disconnect |

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

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

See also
--------

* Using the Web Audio API
AudioNode: channelCount property
================================

The **`channelCount`** property of the `AudioNode` interface represents an integer used to determine how many channels are used when up-mixing and down-mixing connections to any inputs to the node.

`channelCount`'s usage and precise definition depend on the value of `AudioNode.channelCountMode`:

* It is ignored if the `channelCountMode` value is `max`.
* It is used as a maximum value if the `channelCountMode` value is `clamped-max`.
* It is used as the exact value if the `channelCountMode` value is `explicit`.
Value
-----

An integer.

Examples
--------


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

const oscillator = audioCtx.createOscillator();
const gainNode = audioCtx.createGain();

oscillator.connect(gainNode);
gainNode.connect(audioCtx.destination);

oscillator.channelCount;
```

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

| Specification |
| --- |
| Web Audio API # dom-audionode-channelcount |

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

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

See also
--------

* Using the Web Audio API
AudioNode: numberOfOutputs property
===================================

 The `numberOfOutputs` property of
 the `AudioNode` interface returns the number of outputs coming out of
 the node. Destination nodes — like `AudioDestinationNode` — have
 a value of 0 for this attribute.

Value
-----

An integer ≥ 0.

Examples
--------


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

const oscillator = audioCtx.createOscillator();
const gainNode = audioCtx.createGain();

oscillator.connect(gainNode).connect(audioCtx.destination);

console.log(oscillator.numberOfOutputs); // 1
console.log(gainNode.numberOfOutputs); // 1
console.log(audioCtx.destination.numberOfOutputs); // 0
```

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

| Specification |
| --- |
| Web Audio API # dom-audionode-numberofoutputs |

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

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

See also
--------

* Using the Web Audio API
AudioNode: channelInterpretation property
=========================================

The **`channelInterpretation`** property of the `AudioNode` interface represents an enumerated value describing how input channels are mapped to output channels when the number of inputs/outputs is different. For example, this setting defines how a mono input will be up-mixed to a stereo or 5.1 channel output, or how a quad channel input will be down-mixed to a stereo or mono output.

The property has two options: `speakers` and `discrete`. These are documented in Basic concepts behind Web Audio API > up-mixing and down-mixing.

Value
-----

The values are documented in Basic concepts behind Web Audio API > up-mixing and down-mixing.

In summary:

`speakers`

Use set of "standard" mappings for combinations of common speaker input and outputs setups (mono, stereo, quad, 5.1). For example, with this setting a mono channel input will output to both channels of a stereo output.

`discrete`

Input channels are mapped to output channels in order. If there are more inputs that outputs the additional inputs are dropped; if there are fewer than the unused outputs are silent.

Examples
--------


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

const oscillator = audioCtx.createOscillator();
const gainNode = audioCtx.createGain();

oscillator.connect(gainNode);
gainNode.connect(audioCtx.destination);

oscillator.channelInterpretation = "discrete";
```

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

| Specification |
| --- |
| Web Audio API # dom-audionode-channelinterpretation |

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

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

See also
--------

* Using the Web Audio API
AudioNode: channelCountMode property
====================================

The `channelCountMode` property of the `AudioNode` interface represents an enumerated value describing the way channels must be matched between the node's inputs and outputs.

Value
-----

The possible values of the `channelCountMode` enumerated value, and their meanings are:

`max`

 The number of channels is equal to the maximum number of channels of all connections.
 In this case, `channelCount` is ignored and only up-mixing happens.


The following AudioNode children default to this value: `GainNode`, `DelayNode`, `ScriptProcessorNode`, `BiquadFilterNode`, `WaveShaperNode`.

`clamped-max`

The number of channels is equal to the maximum number of channels of all connections, clamped to the value of `channelCount`.

The following AudioNode children default to this value: `PannerNode`, `ConvolverNode`, `DynamicsCompressorNode`

`explicit`

The number of channels is defined by the value of `channelCount`.

The following AudioNode children default to this value: `AudioDestinationNode`, `AnalyserNode`, `ChannelSplitterNode`, `ChannelMergerNode`


**Note:** In older versions of the spec, the default for a `ChannelSplitterNode` was `max`.

Examples
--------


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

const oscillator = audioCtx.createOscillator();
const gainNode = audioCtx.createGain();

oscillator.connect(gainNode);
gainNode.connect(audioCtx.destination);

oscillator.channelCountMode = "explicit";
```

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

| Specification |
| --- |
| Web Audio API # dom-audionode-channelcountmode |

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

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

See also
--------

* Using the Web Audio API