You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove source-shape callouts from the constructor docs added in this PR.
Rewrite constructor summaries to focus on the ReScript API surface and update the contributor documentation guidance to match.
Constructor overloads should use the same structure, but make the differentiating input shape explicit.
50
-
Link ReScript stdlib types such as `string`, `array<'a>`, `ArrayBuffer.t`, and `DataView.t`, and link project-local records or aliases when the constructor takes one of those shapes.
48
+
Constructor overloads should use the same structure, but keep the description concise and let the signature and example show the input shape.
49
+
Use backticks for specific types and names.
51
50
If a constructor variant has a single source input, show it as a direct unlabeled argument in both the signature and example.
52
51
53
52
````ReScript
54
53
/*
55
54
`fromArray(array<float>)`
56
55
57
-
The DOMMatrix() constructor creates a new DOMMatrix from an array of matrix component values.
58
-
59
-
Source shape:
60
-
- ReScript [array](https://rescript-lang.org/docs/manual/api/stdlib/array) of numeric values accepted by MDN [DOMMatrix()](https://developer.mozilla.org/docs/Web/API/DOMMatrix/DOMMatrix).
56
+
Creates a new `DOMMatrix` from an array of matrix component values.
61
57
62
58
```res
63
59
let matrix = DOMMatrix.fromArray([1., 0., 0., 1., 0., 0.])
The VideoFrame() constructor creates a new VideoFrame from an HTMLImageElement source.
7
-
8
-
Source shape:
9
-
- `image`: local [`HTMLImageElement.t`](../dom/html-image-element#t) mapped to MDN [HTMLImageElement](https://developer.mozilla.org/docs/Web/API/HTMLImageElement).
10
-
- `init`: local [`videoFrameInit`](../dom#videoFrameInit) values for optional frame initialization.
6
+
Creates a new `VideoFrame` from an `HTMLImageElement`.
11
7
12
8
```res
13
9
let frame = VideoFrame.fromHTMLImageElement(~image=myImageElement)
The VideoFrame() constructor creates a new VideoFrame from an SVGImageElement source.
28
-
29
-
Source shape:
30
-
- `image`: local [`SVGImageElement.t`](../dom/svg-image-element#t) mapped to MDN [SVGImageElement](https://developer.mozilla.org/docs/Web/API/SVGImageElement).
31
-
- `init`: local [`videoFrameInit`](../dom#videoFrameInit) values for optional frame initialization.
23
+
Creates a new `VideoFrame` from an `SVGImageElement`.
32
24
33
25
```res
34
26
let frame = VideoFrame.fromSVGImageElement(~image=mySvgImageElement)
The VideoFrame() constructor creates a new VideoFrame from an HTMLVideoElement source.
49
-
50
-
Source shape:
51
-
- `image`: local [`HTMLVideoElement.t`](../dom/html-video-element#t) mapped to MDN [HTMLVideoElement](https://developer.mozilla.org/docs/Web/API/HTMLVideoElement).
52
-
- `init`: local [`videoFrameInit`](../dom#videoFrameInit) values for optional frame initialization.
40
+
Creates a new `VideoFrame` from an `HTMLVideoElement`.
53
41
54
42
```res
55
43
let frame = VideoFrame.fromHTMLVideoElement(~image=myVideoElement)
The VideoFrame() constructor creates a new VideoFrame from an HTMLCanvasElement source.
70
-
71
-
Source shape:
72
-
- `image`: local [`HTMLCanvasElement.t`](./html-canvas-element#t) mapped to MDN [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement).
73
-
- `init`: local [`videoFrameInit`](../dom#videoFrameInit) values for optional frame initialization.
57
+
Creates a new `VideoFrame` from an `HTMLCanvasElement`.
74
58
75
59
```res
76
60
let frame = VideoFrame.fromHTMLCanvasElement(~image=myCanvasElement)
The VideoFrame() constructor creates a new VideoFrame from an OffscreenCanvas source.
112
-
113
-
Source shape:
114
-
- `image`: local [`OffscreenCanvas.t`](./offscreen-canvas#t) mapped to MDN [OffscreenCanvas](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas).
115
-
- `init`: local [`videoFrameInit`](../dom#videoFrameInit) values for optional frame initialization.
91
+
Creates a new `VideoFrame` from an `OffscreenCanvas`.
116
92
117
93
```res
118
94
let frame = VideoFrame.fromOffscreenCanvas(~image=myOffscreenCanvas)
The VideoFrame() constructor creates a new VideoFrame from SharedArrayBuffer-backed pixel data.
176
-
177
-
Source shape:
178
-
- `data`: opaque SharedArrayBuffer-aligned data accepted by MDN [SharedArrayBuffer](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer).
179
-
- `init`: local [`videoFrameBufferInit`](../dom#videoFrameBufferInit) values describing the buffer-backed frame layout.
143
+
Creates a new `VideoFrame` from `SharedArrayBuffer`-backed pixel data.
The DOMMatrix() constructor creates a new DOMMatrix from an array of matrix component values.
39
-
40
-
Source shape:
41
-
- ReScript [array](https://rescript-lang.org/docs/manual/api/stdlib/array) of numeric values accepted by MDN [DOMMatrix()](https://developer.mozilla.org/docs/Web/API/DOMMatrix/DOMMatrix).
32
+
Creates a new `DOMMatrix` from an array of matrix component values.
42
33
43
34
```res
44
35
let matrix = DOMMatrix.fromArray([1., 0., 0., 1., 0., 0.])
The DOMMatrixReadOnly() constructor creates a new DOMMatrixReadOnly value from an array of matrix component values.
39
-
40
-
Source shape:
41
-
- ReScript [array](https://rescript-lang.org/docs/manual/api/stdlib/array) of numeric values accepted by MDN [DOMMatrixReadOnly()](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/DOMMatrixReadOnly).
32
+
Creates a new `DOMMatrixReadOnly` from an array of matrix component values.
42
33
43
34
```res
44
35
let matrix = DOMMatrixReadOnly.fromArray([1., 0., 0., 1., 0., 0.])
The ReadableStream() constructor creates a new ReadableStream from an underlying source definition.
27
-
28
-
Source shape:
29
-
- local [`underlyingSource<'t>`](../#underlyingSource) values accepted by MDN [ReadableStream()](https://developer.mozilla.org/docs/Web/API/ReadableStream/ReadableStream).
23
+
Creates a new `ReadableStream` from an `underlyingSource`.
30
24
31
25
```res
32
26
let stream = ReadableStream.fromUnderlyingSource(myUnderlyingSource)
The ReadableStream() constructor creates a new ReadableStream from an underlying source definition and a queuing strategy.
44
-
45
-
Source shape:
46
-
- local [`underlyingSource<'t>`](../#underlyingSource) values accepted by MDN [ReadableStream()](https://developer.mozilla.org/docs/Web/API/ReadableStream/ReadableStream).
47
-
- local [`queuingStrategy<'t>`](../#queuingStrategy) values describing the stream queueing behavior.
37
+
Creates a new `ReadableStream` from an `underlyingSource` and `queuingStrategy`.
Copy file name to clipboardExpand all lines: packages/MediaCaptureAndStreams/src/MediaStream.res
+3-12Lines changed: 3 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -3,10 +3,7 @@ type t = Types.mediaStream = private {...Types.mediaStream}
3
3
/**
4
4
`make()`
5
5
6
-
The MediaStream() constructor creates a new empty MediaStream.
7
-
8
-
Source shape:
9
-
- no source input; this constructor creates a fresh MDN [MediaStream](https://developer.mozilla.org/docs/Web/API/MediaStream).
6
+
Creates a new empty `MediaStream`.
10
7
11
8
```res
12
9
let stream = MediaStream.make()
@@ -20,10 +17,7 @@ external make: unit => t = "MediaStream"
20
17
/**
21
18
`fromMediaStream(mediaStream)`
22
19
23
-
The MediaStream() constructor creates a new MediaStream by copying another MediaStream source.
24
-
25
-
Source shape:
26
-
- local [`MediaStream.t`](#t) mapped to MDN [MediaStream](https://developer.mozilla.org/docs/Web/API/MediaStream).
20
+
Creates a new `MediaStream` by copying another `MediaStream`.
27
21
28
22
```res
29
23
let copiedStream = MediaStream.fromMediaStream(existingStream)
@@ -37,10 +31,7 @@ external fromMediaStream: t => t = "MediaStream"
37
31
/**
38
32
`fromTracks(array<MediaStreamTrack.t>)`
39
33
40
-
The MediaStream() constructor creates a new MediaStream from an array of MediaStreamTrack values.
41
-
42
-
Source shape:
43
-
- ReScript [array](https://rescript-lang.org/docs/manual/api/stdlib/array) of local [`MediaStreamTrack.t`](./media-stream-track#t) values mapped to MDN [MediaStreamTrack](https://developer.mozilla.org/docs/Web/API/MediaStreamTrack).
34
+
Creates a new `MediaStream` from an array of `MediaStreamTrack.t` values.
44
35
45
36
```res
46
37
let stream = MediaStream.fromTracks([audioTrack, videoTrack])
0 commit comments