Skip to content
Merged
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
24 changes: 0 additions & 24 deletions packages/DOM/src/Window.res
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,6 @@ external open_: (
@send
external alert: Types.window => unit = "alert"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/alert)
*/
@send
external alert2: (Types.window, string) => unit = "alert"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/alert)
*/
Expand Down Expand Up @@ -532,12 +526,6 @@ external resizeBy: (Types.window, ~x: int, ~y: int) => unit = "resizeBy"
@send
external scroll: (Types.window, ~options: Types.scrollToOptions=?) => unit = "scroll"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/scroll)
*/
@send
external scroll2: (Types.window, ~x: float, ~y: float) => unit = "scroll"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/scroll)
*/
Expand All @@ -550,12 +538,6 @@ external scrollXY: (Types.window, ~x: float, ~y: float) => unit = "scroll"
@send
external scrollTo: (Types.window, ~options: Types.scrollToOptions=?) => unit = "scrollTo"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/scrollTo)
*/
@send
external scrollTo2: (Types.window, ~x: float, ~y: float) => unit = "scrollTo"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/scrollTo)
*/
Expand All @@ -568,12 +550,6 @@ external scrollToXY: (Types.window, ~x: float, ~y: float) => unit = "scrollTo"
@send
external scrollBy: (Types.window, ~options: Types.scrollToOptions=?) => unit = "scrollBy"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/scrollBy)
*/
@send
external scrollBy2: (Types.window, ~x: float, ~y: float) => unit = "scrollBy"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/scrollBy)
*/
Expand Down
15 changes: 5 additions & 10 deletions packages/Fetch/src/FormDataEntryValue.res
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
type t = Types.formDataEntryValue
@unboxed
type t =
| String(string)
| File(WebApiFile.File.t)

external fromString: string => t = "%identity"
external fromFile: WebApiFile.File.t => t = "%identity"

type decoded =
| String(string)
| File(WebApiFile.File.t)

let decode = (t: t): decoded =>
switch t {
| Types.String(value) => String(value)
| Types.File(file) => File(file)
}
let decode = (value: t): t => value
4 changes: 2 additions & 2 deletions packages/MediaCaptureAndStreams/src/MediaStream.res
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ external make: unit => t = "MediaStream"
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/MediaStream)
*/
@new
external make2: t => t = "MediaStream"
external makeFromMediaStream: t => t = "MediaStream"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/MediaStream)
*/
@new
external make3: array<MediaStreamTrack.t> => t = "MediaStream"
external makeFromMediaStreams: array<MediaStreamTrack.t> => t = "MediaStream"

include WebApiEvent.EventTarget.Impl({type t = t})

Expand Down
19 changes: 2 additions & 17 deletions packages/WebSockets/src/MessageEvent.res
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,8 @@ type event = WebApiEvent.Types.event
type eventTarget = WebApiEvent.Types.eventTarget
type messageEventSource = Types.messageEventSource

type messageEvent<'t> = {
...event,
data: 't,
origin: string,
lastEventId: string,
source: Null.t<messageEventSource>,
ports: array<WebApiChannelMessaging.Types.messagePort>,
}

type messageEventInit<'t> = {
...WebApiEvent.Types.eventInit,
mutable data?: 't,
mutable origin?: string,
mutable lastEventId?: string,
mutable source?: Null.t<messageEventSource>,
mutable ports?: array<WebApiChannelMessaging.Types.messagePort>,
}
type messageEvent<'t> = Types.messageEvent<'t>
type messageEventInit<'t> = Types.messageEventInit<'t>

type t<'t> = messageEvent<'t>

Expand Down
22 changes: 11 additions & 11 deletions tests/FetchAPI/Request__test.res
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
let req = WebApiFetch.Request.fromURL("https://example.com")

let blob: WebApiFile.Blob.t = WebApiFile.Blob.make(~blobParts=[])
let file: WebApiFile.File.t = WebApiFile.File.make(~fileBits=[], ~fileName="hello.txt")
let params: WebApiURL.URLSearchParams.t = WebApiURL.URLSearchParams.fromString("greeting=hello")
let formData: WebApiFetch.FormData.t = WebApiFetch.FormData.make()
let stream: WebApiFile.ReadableStream.t<array<int>> = WebApiFile.ReadableStream.make()
let blob = WebApiFile.Blob.make(~blobParts=[])
let file = WebApiFile.File.make(~fileBits=[], ~fileName="hello.txt")
let params = WebApiURL.URLSearchParams.fromString("greeting=hello")
let formData = WebApiFetch.FormData.make()
let stream = WebApiFile.ReadableStream.make()

let stringBody: WebApiFetch.BodyInit.t = WebApiFetch.BodyInit.fromString("hello")
let blobBody: WebApiFetch.BodyInit.t = WebApiFetch.BodyInit.fromBlob(blob)
let fileBody: WebApiFetch.BodyInit.t = WebApiFetch.BodyInit.fromFile(file)
let paramsBody: WebApiFetch.BodyInit.t = WebApiFetch.BodyInit.fromURLSearchParams(params)
let formDataBody: WebApiFetch.BodyInit.t = WebApiFetch.BodyInit.fromFormData(formData)
let streamBody: WebApiFetch.BodyInit.t = WebApiFetch.BodyInit.fromReadableStream(stream)
let stringBody = WebApiFetch.BodyInit.fromString("hello")
let blobBody = WebApiFetch.BodyInit.fromBlob(blob)
let fileBody = WebApiFetch.BodyInit.fromFile(file)
let paramsBody = WebApiFetch.BodyInit.fromURLSearchParams(params)
let formDataBody = WebApiFetch.BodyInit.fromFormData(formData)
let streamBody = WebApiFetch.BodyInit.fromReadableStream(stream)

let req1 = WebApiFetch.Request.fromURL(
"https://example.com/api",
Expand Down
12 changes: 6 additions & 6 deletions tests/FetchAPI/Response__test.res
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
let headers: WebApiFetch.HeadersInit.t = WebApiFetch.HeadersInit.fromDict(dict{"X-Fruit": "Peach"})
let blob: WebApiFile.Blob.t = WebApiFile.Blob.make(~blobParts=[])
let file: WebApiFile.File.t = WebApiFile.File.make(~fileBits=[], ~fileName="pong.txt")
let params: WebApiURL.URLSearchParams.t = WebApiURL.URLSearchParams.fromString("fruit=peach")
let formData: WebApiFetch.FormData.t = WebApiFetch.FormData.make()
let stream: WebApiFile.ReadableStream.t<array<int>> = WebApiFile.ReadableStream.make()
let headers = WebApiFetch.HeadersInit.fromDict(dict{"X-Fruit": "Peach"})
let blob = WebApiFile.Blob.make(~blobParts=[])
let file = WebApiFile.File.make(~fileBits=[], ~fileName="pong.txt")
let params = WebApiURL.URLSearchParams.fromString("fruit=peach")
let formData = WebApiFetch.FormData.make()
let stream = WebApiFile.ReadableStream.make()

let response = WebApiFetch.Response.fromNull(~init={status: 204, headers})

Expand Down
6 changes: 0 additions & 6 deletions tests/Global__test.res
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,3 @@ let (auth, p256dh) = switch pushSubscriptionJSON.keys {
}
Console.log(`For subscription ${subscription.endpoint}, auth is ${auth} and p256dh is ${p256dh}`)

let _setIntervalWithCallback = WebApiDOM.Window.setIntervalWithCallback
let _alertWithMessage = WebApiDOM.Window.alertWithMessage
let _postMessageWithOptions = WebApiDOM.Window.postMessageWithOptions
let _scrollXY = WebApiDOM.Window.scrollXY
let _scrollToXY = WebApiDOM.Window.scrollToXY
let _scrollByXY = WebApiDOM.Window.scrollByXY