Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ and add `@rescript/webapi` to your `rescript.json`:
## Usage

```rescript
let location = WebAPI.Window.current->WebAPI.Window.location
let location = WebAPI.Base.window->WebAPI.Window.location
let href = location.href
location->WebAPI.Location.reload
```
Expand Down
10 changes: 5 additions & 5 deletions docs/content/docs/api-surface.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ add the package to `rescript.json`:
}
```

Use `WebAPI.Window.current` for the browser `window`. Interface-specific methods live on
Use `WebAPI.Base.window` for the browser `window`. Interface-specific methods live on
public modules such as `WebAPI.Window`, `WebAPI.Location`, `WebAPI.Document`,
`WebAPI.Element`, `WebAPI.Request`, and `WebAPI.Response`.

```ReScript
let location = WebAPI.Window.current->WebAPI.Window.location
let location = WebAPI.Base.window->WebAPI.Window.location
let href = location.href

location->WebAPI.Location.reload
Expand All @@ -32,7 +32,7 @@ helper modules.
```ReScript
let req: WebAPI.Request.t = WebAPI.Request.fromURL("https://example.com")
let headers = WebAPI.Headers.make()
let document = WebAPI.Window.current->WebAPI.Window.document
let document = WebAPI.Base.window->WebAPI.Window.document
let element = document->WebAPI.Document.createElement("button")
```

Expand Down Expand Up @@ -243,7 +243,7 @@ let redirect = WebAPI.Response.redirect(~url="/login", ~status=302)
DOM values are operated on through public interface modules.

```ReScript
let document = WebAPI.Window.current->WebAPI.Window.document
let document = WebAPI.Base.window->WebAPI.Window.document

let maybeButton = document
->WebAPI.Document.querySelector("button")
Expand Down Expand Up @@ -271,7 +271,7 @@ let node = element->WebAPI.Element.asNode
`Window.visualViewport` returns a nullable `WebAPI.VisualViewport.t`.

```ReScript
let maybeViewport = WebAPI.Window.current
let maybeViewport = WebAPI.Base.window
->WebAPI.Window.visualViewport
->Null.toOption

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const rescriptJson = `
After installing the package , you can use bindings for the various Web APIs as defined in [MDN](https://developer.mozilla.org/en-US/docs/Web/API).

export const rescriptSample = `
let location = WebAPI.Window.current->WebAPI.Window.location
let location = WebAPI.Base.window->WebAPI.Window.location

// Access properties using \`.\`
let href = location.href
Expand Down
Loading
Loading