Experimental successor to rescript-webapi
ReScript 13.0.0-alpha.5 is the tested compiler baseline. Library alpha releases may contain
breaking changes. See the project status
for the accepted peer range and its testing limits.
Install the library and compiler in your application:
npm install @rescript/webapi@alpha
npm install --save-dev [email protected]The @alpha command targets the published alpha dist-tag. The planned 1.0.0-alpha.1 candidate
is not published yet; see project status
for the current tag and note that candidate installation is verified from its packed tarball.
Add a source directory and the package dependency to rescript.json:
{
"name": "webapi-consumer",
"sources": [{ "dir": "src" }],
"dependencies": ["@rescript/webapi"]
}In src/Main.res:
let location = WebAPI.DOM.window->WebAPI.Window.location
let href = location.href
location->WebAPI.Location.reloadCompile the consumer with:
npx rescript buildThe namespace is flat under WebAPI; internal implementation modules are not public API.
More information can be found on https://rescript-lang.github.io/experimental-rescript-webapi/. See the alpha release checklist and migration notes for known limitations and breaking changes.