File tree 2 files changed +27
-0
lines changed
2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 658
658
avatar : " https://avatars.githubusercontent.com/u/24900688?u=f55f5ef982cc7b992eadd7f58fa34dc7abd45233&v=4"
659
659
tier : 2
660
660
square_avatar : false
661
+ - name : " Xetera"
662
+ url : " https://github.com/Xetera"
663
+ avatar : " https://avatars.githubusercontent.com/u/24978328?u=e4286d30bfd5917cc750729b877316610cd41c13&v=4"
664
+ tier : 1
665
+ square_avatar : false
661
666
- name : " Zsombor Gasparin"
662
667
url : " https://github.com/gasparinzsombor"
663
668
avatar : " https://avatars.githubusercontent.com/u/25465322?u=18186bbf5e9df8274c5795f2d8359a06ebf0885c&v=4"
Original file line number Diff line number Diff line change @@ -250,3 +250,25 @@ LoggedIn("Kim")
250
250
guest ,
251
251
{logged_in , <<" Kim" >>}.
252
252
```
253
+
254
+ ## JavaScript interop
255
+
256
+ When compiling to JavaScript, each constructor becomes a class of the same name.
257
+ Each of the generated JavaScript classes has a constructor with the same
258
+ arguments as the original type constructor.
259
+
260
+ ``` gleam
261
+ // Gleam
262
+ Guest
263
+ LoggedIn("Kim")
264
+ Cat(name: "Jinx", cuteness: 2002)
265
+ ```
266
+
267
+ ``` javascript
268
+ // JavaScript
269
+ import { Guest , LoggedIn , Cat } from " my_module.mjs" ;
270
+
271
+ new Guest ();
272
+ new LoggedIn (" Kim" );
273
+ new Cat (" Jinx" , 2002 );
274
+ ```
You can’t perform that action at this time.
0 commit comments