Skip to content

Commit 469231f

Browse files
authored
Merge pull request #189 from alex35mil/image-data-type
Fix `imageData.data` type
2 parents 067a895 + 6226e6a commit 469231f

4 files changed

Lines changed: 20 additions & 4 deletions

File tree

src/DOMAPI.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3020,7 +3020,7 @@ and htmlCollectionOf<'t> = {
30203020
}
30213021

30223022
/**
3023-
A collection of HTML form control elements.
3023+
A collection of HTML form control elements.
30243024
[See HTMLFormControlsCollection on MDN](https://developer.mozilla.org/docs/Web/API/HTMLFormControlsCollection)
30253025
*/
30263026
@editor.completeFrom(HTMLFormControlsCollection) and htmlFormControlsCollection = {
@@ -9403,7 +9403,7 @@ type imageData = {
94039403
Returns the one-dimensional array containing the data in RGBA order, as integers in the range 0 to 255.
94049404
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ImageData/data)
94059405
*/
9406-
data: array<int>,
9406+
data: Uint8ClampedArray.t,
94079407
/**
94089408
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ImageData/colorSpace)
94099409
*/

src/DOMAPI/ImageData.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ external make: (~sw: int, ~sh: int, ~settings: imageDataSettings=?) => imageData
1010
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ImageData)
1111
*/
1212
@new
13-
external make2: (
14-
~data: array<int>,
13+
external makeWithData: (
14+
~data: Uint8ClampedArray.t,
1515
~sw: int,
1616
~sh: int=?,
1717
~settings: imageDataSettings=?,

tests/DOMAPI/ImageData__test.js

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/DOMAPI/ImageData__test.res

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
open DOMAPI
2+
3+
let imageData = ImageData.makeWithData(~data=Uint8ClampedArray.fromArray([]), ~sw=100, ~sh=100)
4+
5+
imageData.data->TypedArray.length->Console.log

0 commit comments

Comments
 (0)