February 2019
Beginner to intermediate
180 pages
4h 4m
English
We can use [@bs.val] to bind to global values and functions. In general, the syntax is as follows:
[@bs.val] external alert: string => unit = "alert";
The external keyword binds alert to a value of type string => unit and is bound to the string alert. The string alert is the value of the above external declaration and is what is going to be used in the compiled output. When the name of the external binding is equal to its string value, the string can be left empty:
[@bs.val] external alert: string => unit = "";
Using the binding is just like using any ...
Read now
Unlock full access