Skip to content

Commit c522718

Browse files
authored
Update MDN documentation (#213)
1 parent f80dcab commit c522718

File tree

6 files changed

+131
-26
lines changed

6 files changed

+131
-26
lines changed

lib/src/dom/cssom.dart

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,12 @@ extension type CSSStyleSheetInit._(JSObject _) implements JSObject {
264264
/// However it can be iterated over in a standard `for` loop over its indices,
265265
/// or converted to an `Array`.
266266
///
267-
/// > **Note:** This interface was an
268-
/// > [attempt to create an unmodifiable list](https://stackoverflow.com/questions/74630989/why-use-domstringlist-rather-than-an-array/74641156#74641156)
269-
/// > and only continues to be supported to not break code that's already using
270-
/// > it. Modern APIs use types that wrap around ECMAScript array types instead,
271-
/// > so you can treat them like ECMAScript arrays, and at the same time impose
272-
/// > additional semantics on their usage (such as making their items
273-
/// > read-only).
267+
/// > **Note:** Typically list interfaces like `StyleSheetList` wrap around
268+
/// > `Array` types, so you can use `Array` methods on them.
269+
/// > This is not the case here for
270+
/// > [historical reasons](https://stackoverflow.com/questions/74630989/why-use-domstringlist-rather-than-an-array/74641156#74641156).
271+
/// > However, you can convert `StyleSheetList` to an `Array` in order to use
272+
/// > those methods (see the example below).
274273
///
275274
/// ---
276275
///

lib/src/dom/html.dart

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3050,7 +3050,7 @@ extension type HTMLVideoElement._(JSObject _)
30503050
external VideoPlaybackQuality getVideoPlaybackQuality();
30513051

30523052
/// The **`width`** property of the [HTMLVideoElement] interface returns an
3053-
/// integer that that reflects the `width` attribute of the `video` element,
3053+
/// integer that reflects the `width` attribute of the `video` element,
30543054
/// specifying the displayed width of the resource in CSS pixels.
30553055
external int get width;
30563056
external set width(int value);
@@ -9113,27 +9113,25 @@ extension type Window._(JSObject _) implements EventTarget, JSObject {
91139113
/// This method will block while the print dialog is open.
91149114
external void print();
91159115

9116-
/// The **`window.postMessage()`** method safely enables
9117-
/// cross-origin communication between [Window] objects; _e.g.,_ between
9118-
/// a page and a pop-up that it spawned, or between a page and an iframe
9119-
/// embedded within it.
9116+
/// The **`window.postMessage()`** method safely enables cross-origin
9117+
/// communication between [Window] objects; _e.g.,_ between a page and a
9118+
/// pop-up that it spawned, or between a page and an iframe embedded within
9119+
/// it.
91209120
///
91219121
/// Normally, scripts on different pages are allowed to access each other if
9122-
/// and only if
9123-
/// the pages they originate from share the same protocol, port number, and
9124-
/// host (also known
9125-
/// as the
9122+
/// and only if the pages they originate from share the same protocol, port
9123+
/// number, and host (also known as the
91269124
/// "[same-origin policy](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy)").
91279125
/// `window.postMessage()` provides a controlled mechanism to securely
91289126
/// circumvent this restriction (if used properly).
91299127
///
91309128
/// Broadly, one window may obtain a reference to another (_e.g.,_ via
9131-
/// `targetWindow = window.opener`), and then dispatch a
9132-
/// [MessageEvent] on it with `targetWindow.postMessage()`. The
9133-
/// receiving window is then free to
9129+
/// `targetWindow = window.opener`), and then dispatch a [MessageEvent] on it
9130+
/// with `targetWindow.postMessage()`.
9131+
/// The receiving window is then free to
91349132
/// [handle this event](https://developer.mozilla.org/en-US/docs/Web/Events/Event_handlers)
9135-
/// as needed. The arguments passed to `window.postMessage()`
9136-
/// (_i.e.,_ the "message") are
9133+
/// as needed.
9134+
/// The arguments passed to `window.postMessage()` (_i.e.,_ the "message") are
91379135
/// [exposed to the receiving window through the event object](#the_dispatched_event).
91389136
external void postMessage(
91399137
JSAny? message, [

lib/src/dom/navigation_timing.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,19 @@ extension type PerformanceNavigationTiming._(JSObject _)
161161
/// Note that client side redirects, such as `<meta http-equiv="refresh"
162162
/// content="0; url=https://example.com/">` are not considered here.
163163
external int get redirectCount;
164+
165+
/// A website can indicate that a particular
166+
/// [Client Hint](https://developer.mozilla.org/en-US/docs/Web/HTTP/Client_hints)
167+
/// is critical to the page by including it in a HTTP response header (as
168+
/// well as the HTTP request header which is needed for all client hints
169+
/// whether critical or not). Doing so will trigger a connection restart if
170+
/// the hint listed in the `Critical-CH` HTTP response header could have been,
171+
/// but wasn't, included in the HTTP request initially sent. If the browser
172+
/// does not support that client hint, it is ignored and no connection restart
173+
/// occurs.
174+
///
175+
/// The **`criticalCHRestart`** read-only property represents the time at
176+
/// which the connection restart occurred.
164177
external DOMHighResTimeStamp get criticalCHRestart;
165178
}
166179

lib/src/dom/webgl2.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,13 +1946,22 @@ extension type WebGL2RenderingContext._(JSObject _) implements JSObject {
19461946
/// binds a
19471947
/// passed [WebGLVertexArrayObject] object to the buffer.
19481948
external void bindVertexArray(WebGLVertexArrayObject? array);
1949+
1950+
/// The **`WebGL2RenderingContext.bufferData()`** method of the
1951+
/// [WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API)
1952+
/// creates and initializes the buffer object's data store.
19491953
external void bufferData(
19501954
GLenum target,
19511955
JSAny sizeOrSrcData,
19521956
GLenum usage, [
19531957
int srcOffset,
19541958
GLuint length,
19551959
]);
1960+
1961+
/// The **`WebGL2RenderingContext.bufferSubData()`** method of the
1962+
/// [WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API)
1963+
/// updates a subset of a buffer
1964+
/// object's data store.
19561965
external void bufferSubData(
19571966
GLenum target,
19581967
GLintptr dstByteOffset,

lib/src/dom/webrtc_stats.dart

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,40 @@ extension type RTCRtpStreamStats._(JSObject _) implements RTCStats, JSObject {
9191
external String get codecId;
9292
external set codecId(String value);
9393
}
94+
95+
/// The **`RTCCodecStats`** dictionary of the
96+
/// [WebRTC API](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API)
97+
/// provides statistics about a codec used by streams that are being sent or
98+
/// received by the associated [RTCPeerConnection] object.
99+
///
100+
/// These statistics can be obtained by iterating the [RTCStatsReport] object
101+
/// returned by [RTCPeerConnection.getStats] until you find an entry with the
102+
/// [`type`](#type) of `codec`.
103+
///
104+
/// The codec statistics can be correlated with the inbound or outbound stream
105+
/// statistics (both local and remote) by matching their `codecId` property to
106+
/// the codec's `id`.
107+
/// For example, if
108+
/// [`RTCInboundRtpStreamStats.codecId`](/en-US/docs/Web/API/RTCInboundRtpStreamStats#codecid)
109+
/// matches an [`RTCCodecStats.id`](#id) in the same report, then we know that
110+
/// the codec is being used on this peer connection's inbound stream.
111+
/// If no stream `codecId` references a codec statistic, then that codec
112+
/// statistic object is deleted — if the codec is used again, the statistics
113+
/// object will be recreated with the same `id`.
114+
///
115+
/// Codec objects may be referenced by multiple RTP streams in media sections
116+
/// using the same transport.
117+
/// In fact, user agents are expected to consolidate information into a single
118+
/// "codec" entry per payload type per transport (unless
119+
/// [sdpFmtpLine](#sdpfmtpline) is different when sending or receiving, in which
120+
/// case, different codecs will be needed for encoding and decoding).
121+
/// Note that other transports will use their own distinct `RTCCodecStats`
122+
/// objects.
123+
///
124+
/// ---
125+
///
126+
/// API documentation sourced from
127+
/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/RTCCodecStats).
94128
extension type RTCCodecStats._(JSObject _) implements RTCStats, JSObject {
95129
external factory RTCCodecStats({
96130
required DOMHighResTimeStamp timestamp,
@@ -104,16 +138,51 @@ extension type RTCCodecStats._(JSObject _) implements RTCStats, JSObject {
104138
String sdpFmtpLine,
105139
});
106140

141+
/// The **`payloadType`** property of the [RTCCodecStats] dictionary is a
142+
/// positive integer in the range from 0 to 127 that describes the format of
143+
/// the payload used in RTP encoding or decoding.
107144
external int get payloadType;
108145
external set payloadType(int value);
146+
147+
/// The **`transportId`** property of the [RTCCodecStats] dictionary is a
148+
/// string that contains the unique identifier of the corresponding transport
149+
/// on which this codec is being used.
150+
///
151+
/// You can correlate the codec and associated transport statistics by
152+
/// matching the `RTCCodecStats.transportId` with an [RTCTransportStats.id]
153+
/// value.
109154
external String get transportId;
110155
external set transportId(String value);
156+
157+
/// The **`mimeType`** property of the [RTCCodecStats] dictionary is a string
158+
/// containing the codec's and subtype.
159+
///
160+
/// This is of the form `"type/subtype"`, such as "video/VP8" or "audio/opus",
161+
/// as defined in the
162+
/// [IANA registry of valid MIME types](https://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-2).
111163
external String get mimeType;
112164
external set mimeType(String value);
165+
166+
/// The **`clockRate`** property of the [RTCCodecStats] dictionary is a
167+
/// positive number containing the media sampling rate in hertz (Hz).
113168
external int get clockRate;
114169
external set clockRate(int value);
170+
171+
/// The **`channels`** property of the [RTCCodecStats] dictionary is a
172+
/// positive number containing the number of channels supported by the codec.
173+
///
174+
/// For audio codecs, a value of 1 specifies monaural sound while 2 indicates
175+
/// stereo.
115176
external int get channels;
116177
external set channels(int value);
178+
179+
/// The **`sdpFmtpLine`** property of the [RTCCodecStats] dictionary is a
180+
/// string containing the format-specific parameters of the codec.
181+
///
182+
/// These are the values in the `"a=fmtp"` line in the codec's (if present)
183+
/// after the payload type number (see [section 5.8 of the IETF specification
184+
/// for
185+
/// JSEP](https://datatracker.ietf.org/doc/html/draft-ietf-rtcweb-jsep-24#section-5.8)).
117186
external String get sdpFmtpLine;
118187
external set sdpFmtpLine(String value);
119188
}

0 commit comments

Comments
 (0)