23
23
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
24
24
25
25
@@config ({flags : ["-unboxed-types" , "-w" , "-49" ]})
26
- @@ocaml.text (/* DESIGN:
26
+
27
+ /* DESIGN:
27
28
- It does not have any code, all its code will be inlined so that
28
29
there will never be
29
30
{[ require('js')]}
30
31
- Its interface should be minimal
31
32
*/
32
33
33
- "
34
+ /***
34
35
The Js module mostly contains ReScript bindings to _standard JavaScript APIs_
35
36
like [console.log](https://developer.mozilla.org/en-US/docs/Web/API/Console/log),
36
37
or the JavaScript
@@ -71,9 +72,9 @@ Js.log(Js.String.startsWith(\"Re\", \"ReScript\"))
71
72
## Js.Xxx2 Modules
72
73
73
74
Prefer `Js.Array2` over `Js.Array`, `Js.String2` over `Js.String`, etc. The latters are old modules.
74
- " )
75
+ */
75
76
76
- @ ocaml.doc ( " JS object type " )
77
+ /** JS object type */
77
78
type t <'a > = {.. } as 'a
78
79
79
80
module MapperRt = Js_mapperRt
@@ -86,24 +87,22 @@ module Internal = {
86
87
external opaque : 'a => 'a = "%opaque"
87
88
}
88
89
89
- @@ocaml.text ("/*" )
90
-
91
- @ocaml.doc ("
90
+ /**
92
91
Nullable value of this type can be either null or 'a. This type is equivalent to Js.Null.t.
93
- " )
92
+ */
94
93
@unboxed
95
94
type null <+ 'a > = Value ('a ) | @as (null ) Null
96
95
97
- @ ocaml.doc ( "
96
+ /**
98
97
A value of this type can be either undefined or 'a. This type is equivalent to Js.Undefined.t.
99
- " )
98
+ */
100
99
type undefined <+ 'a >
101
100
102
101
@unboxed type nullable <+ 'a > = Value ('a ) | @as (null ) Null | @as (undefined ) Undefined
103
102
104
- @@ ocaml.text ( "
103
+ /***
105
104
A value of this type can be undefined, null or 'a. This type is equivalent to Js.Null_undefined.t.
106
- " )
105
+ */
107
106
108
107
type null_undefined <+ 'a > = nullable <'a >
109
108
@@ -113,177 +112,174 @@ external nullToOption: null<'a> => option<'a> = "#null_to_opt"
113
112
external isNullable : nullable <'a > => bool = "#is_nullable"
114
113
external import : 'a => promise <'a > = "#import"
115
114
116
- @ ocaml.doc ( " The same as {!test} except that it is more permissive on the types of input " )
115
+ /** The same as {!test} except that it is more permissive on the types of input */
117
116
external testAny : 'a => bool = "#is_nullable"
118
117
119
- @ ocaml.doc ( "
118
+ /**
120
119
The promise type, defined here for interoperation across packages.
121
- " )
120
+ */
122
121
type promise <+ 'a , + 'e >
123
122
124
- @ ocaml.doc ( "
123
+ /**
125
124
The same as empty in `Js.Null`. Compiles to `null`.
126
- " )
125
+ */
127
126
external null : null <'a > = "#null"
128
127
129
- @ ocaml.doc ( "
128
+ /**
130
129
The same as empty `Js.Undefined`. Compiles to `undefined`.
131
- " )
130
+ */
132
131
external undefined : undefined <'a > = "#undefined"
133
132
134
- @ ocaml.doc ( "
133
+ /**
135
134
`typeof x` will be compiled as `typeof x` in JS. Please consider functions in
136
135
`Js.Types` for a type safe way of reflection.
137
- " )
136
+ */
138
137
external typeof : 'a => string = "#typeof"
139
138
140
- @val @scope ("console" ) @ ocaml.doc ( " Equivalent to console.log any value. " )
139
+ @val @scope ("console" ) /** Equivalent to console.log any value. */
141
140
external log : 'a => unit = "log"
142
141
143
142
@val @scope ("console" ) external log2 : ('a , 'b ) => unit = "log"
144
143
@val @scope ("console" ) external log3 : ('a , 'b , 'c ) => unit = "log"
145
144
146
145
@val @scope ("console" ) external log4 : ('a , 'b , 'c , 'd ) => unit = "log"
147
146
148
- @val
149
- @scope ("console" )
150
- @variadic
151
- @ocaml.doc (" A convenience function to console.log more than 4 arguments " )
147
+ @val @scope ("console" ) @variadic /** A convenience function to console.log more than 4 arguments */
152
148
external logMany : array <'a > => unit = "log"
153
149
154
150
external eqNull : ('a , null <'a >) => bool = "%bs_equal_null"
155
151
external eqUndefined : ('a , undefined <'a >) => bool = "%bs_equal_undefined"
156
152
external eqNullable : ('a , nullable <'a >) => bool = "%bs_equal_nullable"
157
153
158
- @@ ocaml.text ( " ## Operators " )
154
+ /* ## Operators */
159
155
160
- @ ocaml.doc ( "
156
+ /**
161
157
`unsafe_lt(a, b)` will be compiled as `a < b`.
162
158
It is marked as unsafe, since it is impossible
163
159
to give a proper semantics for comparision which applies to any type
164
- " )
160
+ */
165
161
external unsafe_lt : ('a , 'a ) => bool = "#unsafe_lt"
166
162
167
- @ ocaml.doc ( "
163
+ /**
168
164
`unsafe_le(a, b)` will be compiled as `a <= b`.
169
165
See also `Js.unsafe_lt`.
170
- " )
166
+ */
171
167
external unsafe_le : ('a , 'a ) => bool = "#unsafe_le"
172
168
173
- @ ocaml.doc ( "
169
+ /**
174
170
`unsafe_gt(a, b)` will be compiled as `a > b`.
175
171
See also `Js.unsafe_lt`.
176
- " )
172
+ */
177
173
external unsafe_gt : ('a , 'a ) => bool = "#unsafe_gt"
178
174
179
- @ ocaml.doc ( "
175
+ /**
180
176
`unsafe_ge(a, b)` will be compiled as `a >= b`.
181
177
See also `Js.unsafe_lt`.
182
- " )
178
+ */
183
179
external unsafe_ge : ('a , 'a ) => bool = "#unsafe_ge"
184
180
185
- @@ ocaml.text ( " ## Nested Modules " )
181
+ /* ## Nested Modules */
186
182
187
- @ ocaml.doc ( " Provide utilities for `Js.null<'a>` " )
183
+ /** Provide utilities for `Js.null<'a>` */
188
184
module Null = Js_null
189
185
190
- @ ocaml.doc ( " Provide utilities for `Js.undefined<'a>` " )
186
+ /** Provide utilities for `Js.undefined<'a>` */
191
187
module Undefined = Js_undefined
192
188
193
- @ ocaml.doc ( " Provide utilities for `Js.null_undefined` " )
189
+ /** Provide utilities for `Js.null_undefined` */
194
190
module Nullable = Js_null_undefined
195
191
196
192
module Null_undefined = Js_null_undefined
197
193
198
- @ ocaml.doc ( " Provide utilities for dealing with Js exceptions " )
194
+ /** Provide utilities for dealing with Js exceptions */
199
195
module Exn = Js_exn
200
196
201
- @ ocaml.doc ( " Provide bindings to JS array" )
197
+ /** Provide bindings to JS array*/
202
198
module Array = Js_array
203
199
204
- @ ocaml.doc ( " Provide bindings to JS array" )
200
+ /** Provide bindings to JS array*/
205
201
module Array2 = Js_array2
206
202
207
- @ ocaml.doc ( " Provide bindings to JS string " )
203
+ /** Provide bindings to JS string */
208
204
module String = Js_string
209
205
210
- @ ocaml.doc ( " Provide bindings to JS string " )
206
+ /** Provide bindings to JS string */
211
207
module String2 = Js_string2
212
208
213
- @ ocaml.doc ( " Provide bindings to JS regex expression " )
209
+ /** Provide bindings to JS regex expression */
214
210
module Re = Js_re
215
211
216
- @ ocaml.doc ( " Provide bindings to JS Promise " )
212
+ /** Provide bindings to JS Promise */
217
213
module Promise = Js_promise
218
214
219
- @ ocaml.doc ( " Provide bindings to JS Promise " )
215
+ /** Provide bindings to JS Promise */
220
216
module Promise2 = Js_promise2
221
217
222
- @ ocaml.doc ( " Provide bindings for JS Date " )
218
+ /** Provide bindings for JS Date */
223
219
module Date = Js_date
224
220
225
- @ ocaml.doc ( " Provide utilities for JS dictionary object " )
221
+ /** Provide utilities for JS dictionary object */
226
222
module Dict = Js_dict
227
223
228
- @ ocaml.doc ( " Provide bindings to JS global functions in global namespace" )
224
+ /** Provide bindings to JS global functions in global namespace*/
229
225
module Global = Js_global
230
226
231
- @ ocaml.doc ( " Provide utilities for json " )
227
+ /** Provide utilities for json */
232
228
module Json = Js_json
233
229
234
- @ ocaml.doc ( " Provide bindings for JS `Math` object " )
230
+ /** Provide bindings for JS `Math` object */
235
231
module Math = Js_math
236
232
237
- @ ocaml.doc ( " Provide utilities for `Js.t` " )
233
+ /** Provide utilities for `Js.t` */
238
234
module Obj = Js_obj
239
235
240
- @ ocaml.doc ( " Provide bindings for JS typed array " )
236
+ /** Provide bindings for JS typed array */
241
237
module Typed_array = Js_typed_array
242
238
243
- @ ocaml.doc ( " Provide bindings for JS typed array " )
239
+ /** Provide bindings for JS typed array */
244
240
module TypedArray2 = Js_typed_array2
245
241
246
- @ ocaml.doc ( " Provide utilities for manipulating JS types " )
242
+ /** Provide utilities for manipulating JS types */
247
243
module Types = Js_types
248
244
249
- @ ocaml.doc ( " Provide utilities for JS float " )
245
+ /** Provide utilities for JS float */
250
246
module Float = Js_float
251
247
252
- @ ocaml.doc ( " Provide utilities for int " )
248
+ /** Provide utilities for int */
253
249
module Int = Js_int
254
250
255
- @ ocaml.doc ( " Provide utilities for bigint " )
251
+ /** Provide utilities for bigint */
256
252
module BigInt = Js_bigint
257
253
258
- @ ocaml.doc ( " Provide utilities for File " )
254
+ /** Provide utilities for File */
259
255
module File = Js_file
260
256
261
- @ ocaml.doc ( " Provide utilities for Blob " )
257
+ /** Provide utilities for Blob */
262
258
module Blob = Js_blob
263
259
264
- @ ocaml.doc ( " Provide utilities for option " )
260
+ /** Provide utilities for option */
265
261
module Option = Js_option
266
262
267
- @ ocaml.doc ( " Define the interface for result " )
263
+ /** Define the interface for result */
268
264
module Result = Js_result
269
265
270
- @ ocaml.doc ( " Provide utilities for list " )
266
+ /** Provide utilities for list */
271
267
module List = Js_list
272
268
273
- @ ocaml.doc ( " Provides bindings for JS Vector " )
269
+ /** Provides bindings for JS Vector */
274
270
module Vector = Js_vector
275
271
276
- @ ocaml.doc ( " Provides bindings for console " )
272
+ /** Provides bindings for console */
277
273
module Console = Js_console
278
274
279
- @ ocaml.doc ( " Provides bindings for ES6 Set " )
275
+ /** Provides bindings for ES6 Set */
280
276
module Set = Js_set
281
277
282
- @ ocaml.doc ( " Provides bindings for ES6 WeakSet " )
278
+ /** Provides bindings for ES6 WeakSet */
283
279
module WeakSet = Js_weakset
284
280
285
- @ ocaml.doc ( " Provides bindings for ES6 Map " )
281
+ /** Provides bindings for ES6 Map */
286
282
module Map = Js_map
287
283
288
- @ ocaml.doc ( " Provides bindings for ES6 WeakMap " )
284
+ /** Provides bindings for ES6 WeakMap */
289
285
module WeakMap = Js_weakmap
0 commit comments