Skip to content

Commit

Permalink
Lib: make the typed array api cleaner (#1227)
Browse files Browse the repository at this point in the history
  • Loading branch information
hhugo authored Jan 18, 2022
1 parent 53907dc commit 84908ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
10 changes: 6 additions & 4 deletions lib/js_of_ocaml/typed_array.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
open! Import
open Js

type uint32 = float

class type arrayBuffer =
object
method byteLength : int readonly_prop
Expand Down Expand Up @@ -199,9 +201,9 @@ class type dataView =

method getInt32_ : int -> bool t -> int meth

method getUint32 : int -> float meth
method getUint32 : int -> uint32 meth

method getUint32_ : int -> bool t -> float meth
method getUint32_ : int -> bool t -> uint32 meth

method getFloat32 : int -> float meth

Expand All @@ -227,9 +229,9 @@ class type dataView =

method setInt32_ : int -> int -> bool t -> unit meth

method setUint32 : int -> float -> unit meth
method setUint32 : int -> uint32 -> unit meth

method setUint32_ : int -> float -> bool t -> unit meth
method setUint32_ : int -> uint32 -> bool t -> unit meth

method setFloat32 : int -> float -> unit meth

Expand Down
12 changes: 7 additions & 5 deletions lib/js_of_ocaml/typed_array.mli
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

open Js

type uint32 = float

class type arrayBuffer =
object
method byteLength : int readonly_prop
Expand Down Expand Up @@ -140,7 +142,7 @@ val int32Array_inBuffer : (arrayBuffer t -> int -> int -> int32Array t) constr

val uint32Array : (int -> uint32Array t) constr

val uint32Array_fromArray : (float js_array t -> uint32Array t) constr
val uint32Array_fromArray : (uint32 js_array t -> uint32Array t) constr

val uint32Array_fromTypedArray : (uint32Array t -> uint32Array t) constr

Expand Down Expand Up @@ -194,9 +196,9 @@ class type dataView =

method getInt32_ : int -> bool t -> int meth

method getUint32 : int -> float meth
method getUint32 : int -> uint32 meth

method getUint32_ : int -> bool t -> float meth
method getUint32_ : int -> bool t -> uint32 meth

method getFloat32 : int -> float meth

Expand All @@ -222,9 +224,9 @@ class type dataView =

method setInt32_ : int -> int -> bool t -> unit meth

method setUint32 : int -> float -> unit meth
method setUint32 : int -> uint32 -> unit meth

method setUint32_ : int -> float -> bool t -> unit meth
method setUint32_ : int -> uint32 -> bool t -> unit meth

method setFloat32 : int -> float -> unit meth

Expand Down

0 comments on commit 84908ce

Please sign in to comment.