ReScript WebAPI
ReScript bindings for everything you need in the browser.
Installation
Section titled “Installation”Install the package using your favorite package manager:
npmi@rescript/webapi@experimentalbuni@rescript/webapi@experimentaland add@rescript/webapi to yourrescript.json:
{"bs-dependencies": ["@rescript/webapi",],"bsc-flags": ["-open WebAPI.Global"]}After installing the package , you can use bindings for the various Web APIs as defined inMDN.
// Note that this only works when you added the `-open WebAPI.Global` bsc flag.letlocation=window.location// Access properties using `.`lethref=location.href// Invoke methods using the `->TypeModule.method`location->Location.reloadletlocation =window.location;lethref =location.href;location.reload();export {location,href,}