Skip to content

Promise.t -> promise #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 29, 2024
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
8 changes: 4 additions & 4 deletions docs/content/docs/contributing/code-generation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ For example the `window.fetch` function was generated as:
*/
@send
external fetch: (window, ~input: request, ~init: requestInit=?)
=> Promise.t<response> = "fetch"
=> promise<response> = "fetch"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/fetch)
*/
@send
external fetch2: (window, ~input: string, ~init: requestInit=?)
=> Promise.t<response> = "fetch"
=> promise<response> = "fetch"
```

While not that bad and usable, it can be improved:
Expand All @@ -39,12 +39,12 @@ While not that bad and usable, it can be improved:
/** TODO: add better docs */
@send
external fetch: (window, string, ~init: requestInit=?)
=> Promise.t<response> = "fetch"
=> promise<response> = "fetch"

/** TODO: add better docs */
@send
external fetch_withRequest: (window, request, ~init: requestInit=?)
=> Promise.t<response> = "fetch"
=> promise<response> = "fetch"
```

Once these changes are made, the bindings can be tested and then committed to the repository.
Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/contributing/documentation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ window->Window.fetch("https://rescript-lang.org")
*/
@send
external fetch: (window, string, ~init: requestInit=?)
=> Promise.t<response> = "fetch"
=> promise<response> = "fetch"
````
4 changes: 2 additions & 2 deletions src/CSSFontLoadingAPI.res
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type rec fontFace = {
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFace/loaded)
*/
loaded: Promise.t<fontFace>,
loaded: promise<fontFace>,
}

/**
Expand All @@ -81,7 +81,7 @@ type rec fontFaceSet = {
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFaceSet/ready)
*/
ready: Promise.t<fontFaceSet>,
ready: promise<fontFaceSet>,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFaceSet/status)
*/
Expand Down
2 changes: 1 addition & 1 deletion src/CSSFontLoadingAPI/FontFace.res
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ external make3: (
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFace/load)
*/
@send
external load: fontFace => Promise.t<fontFace> = "load"
external load: fontFace => promise<fontFace> = "load"
2 changes: 1 addition & 1 deletion src/CSSFontLoadingAPI/FontFaceSet.res
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ external clear: fontFaceSet => unit = "clear"
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFaceSet/load)
*/
@send
external load: (fontFaceSet, ~font: string, ~text: string=?) => Promise.t<array<fontFace>> = "load"
external load: (fontFaceSet, ~font: string, ~text: string=?) => promise<array<fontFace>> = "load"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFaceSet/check)
Expand Down
2 changes: 1 addition & 1 deletion src/CanvasAPI/OffscreenCanvas.res
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,5 @@ The argument, if provided, is a dictionary that controls the encoding options of
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/convertToBlob)
*/
@send
external convertToBlob: (offscreenCanvas, ~options: imageEncodeOptions=?) => Promise.t<blob> =
external convertToBlob: (offscreenCanvas, ~options: imageEncodeOptions=?) => promise<blob> =
"convertToBlob"
8 changes: 4 additions & 4 deletions src/ClipboardAPI/Clipboard.res
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ include EventTarget.Impl({
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Clipboard/read)
*/
@send
external read: clipboard => Promise.t<array<clipboardItem>> = "read"
external read: clipboard => promise<array<clipboardItem>> = "read"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Clipboard/readText)
*/
@send
external readText: clipboard => Promise.t<string> = "readText"
external readText: clipboard => promise<string> = "readText"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Clipboard/write)
*/
@send
external write: (clipboard, array<clipboardItem>) => Promise.t<unit> = "write"
external write: (clipboard, array<clipboardItem>) => promise<unit> = "write"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Clipboard/writeText)
*/
@send
external writeText: (clipboard, string) => Promise.t<unit> = "writeText"
external writeText: (clipboard, string) => promise<unit> = "writeText"
2 changes: 1 addition & 1 deletion src/ClipboardAPI/ClipboardItem.res
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ external make: (~items: any, ~options: clipboardItemOptions=?) => clipboardItem
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ClipboardItem/getType)
*/
@send
external getType: (clipboardItem, string) => Promise.t<blob> = "getType"
external getType: (clipboardItem, string) => promise<blob> = "getType"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ClipboardItem/supports_static)
Expand Down
8 changes: 4 additions & 4 deletions src/CredentialManagementAPI/CredentialsContainer.res
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ open CredentialManagementAPI
external get: (
credentialsContainer,
~options: credentialRequestOptions=?,
) => Promise.t<credential> = "get"
) => promise<credential> = "get"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CredentialsContainer/store)
*/
@send
external store: (credentialsContainer, credential) => Promise.t<unit> = "store"
external store: (credentialsContainer, credential) => promise<unit> = "store"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CredentialsContainer/create)
Expand All @@ -22,10 +22,10 @@ external store: (credentialsContainer, credential) => Promise.t<unit> = "store"
external create: (
credentialsContainer,
~options: credentialCreationOptions=?,
) => Promise.t<credential> = "create"
) => promise<credential> = "create"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CredentialsContainer/preventSilentAccess)
*/
@send
external preventSilentAccess: credentialsContainer => Promise.t<unit> = "preventSilentAccess"
external preventSilentAccess: credentialsContainer => promise<unit> = "preventSilentAccess"
4 changes: 2 additions & 2 deletions src/DOMAPI.res
Original file line number Diff line number Diff line change
Expand Up @@ -9524,11 +9524,11 @@ type rec animation = {
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/ready)
*/
ready: Promise.t<animation>,
ready: promise<animation>,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/finished)
*/
finished: Promise.t<animation>,
finished: promise<animation>,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Animation/startTime)
*/
Expand Down
2 changes: 1 addition & 1 deletion src/DOMAPI/CSSStyleSheet.res
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ external deleteRule: (cssStyleSheet, int) => unit = "deleteRule"
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/replace)
*/
@send
external replace: (cssStyleSheet, string) => Promise.t<cssStyleSheet> = "replace"
external replace: (cssStyleSheet, string) => promise<cssStyleSheet> = "replace"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/replaceSync)
Expand Down
2 changes: 1 addition & 1 deletion src/DOMAPI/CustomElementRegistry.res
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ external getName: (customElementRegistry, customElementConstructor) => string =
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CustomElementRegistry/whenDefined)
*/
@send
external whenDefined: (customElementRegistry, string) => Promise.t<customElementConstructor> =
external whenDefined: (customElementRegistry, string) => promise<customElementConstructor> =
"whenDefined"

/**
Expand Down
8 changes: 4 additions & 4 deletions src/DOMAPI/Document.res
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ Stops document's fullscreen element from being displayed fullscreen and resolves
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/exitFullscreen)
*/
@send
external exitFullscreen: document => Promise.t<unit> = "exitFullscreen"
external exitFullscreen: document => promise<unit> = "exitFullscreen"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/parseHTMLUnsafe_static)
Expand Down Expand Up @@ -432,7 +432,7 @@ external hasFocus: document => bool = "hasFocus"
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/exitPictureInPicture)
*/
@send
external exitPictureInPicture: document => Promise.t<unit> = "exitPictureInPicture"
external exitPictureInPicture: document => promise<unit> = "exitPictureInPicture"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/exitPointerLock)
Expand All @@ -451,10 +451,10 @@ external getSelection: document => selection = "getSelection"
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/hasStorageAccess)
*/
@send
external hasStorageAccess: document => Promise.t<bool> = "hasStorageAccess"
external hasStorageAccess: document => promise<bool> = "hasStorageAccess"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/requestStorageAccess)
*/
@send
external requestStorageAccess: document => Promise.t<unit> = "requestStorageAccess"
external requestStorageAccess: document => promise<unit> = "requestStorageAccess"
4 changes: 2 additions & 2 deletions src/DOMAPI/Element.res
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,14 @@ When supplied, options's navigationUI member indicates whether showing navigatio
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/requestFullscreen)
*/
@send
external requestFullscreen: (T.t, ~options: fullscreenOptions=?) => Promise.t<unit> =
external requestFullscreen: (T.t, ~options: fullscreenOptions=?) => promise<unit> =
"requestFullscreen"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/requestPointerLock)
*/
@send
external requestPointerLock: (T.t, ~options: pointerLockOptions=?) => Promise.t<unit> =
external requestPointerLock: (T.t, ~options: pointerLockOptions=?) => promise<unit> =
"requestPointerLock"

/**
Expand Down
2 changes: 1 addition & 1 deletion src/DOMAPI/HTMLImageElement.res
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ include HTMLElement.Impl({
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLImageElement/decode)
*/
@send
external decode: htmlImageElement => Promise.t<unit> = "decode"
external decode: htmlImageElement => promise<unit> = "decode"
6 changes: 3 additions & 3 deletions src/DOMAPI/HTMLMediaElement.res
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@ Loads and starts playback of a media resource.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/play)
*/
@send
external play: T.t => Promise.t<unit> = "play"
external play: T.t => promise<unit> = "play"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/setMediaKeys)
*/
@send
external setMediaKeys: (T.t, mediaKeys) => Promise.t<unit> = "setMediaKeys"
external setMediaKeys: (T.t, mediaKeys) => promise<unit> = "setMediaKeys"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/setSinkId)
*/
@send
external setSinkId: (T.t, string) => Promise.t<unit> = "setSinkId"
external setSinkId: (T.t, string) => promise<unit> = "setSinkId"
}

include Impl({
Expand Down
2 changes: 1 addition & 1 deletion src/DOMAPI/HTMLVideoElement.res
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ external getVideoPlaybackQuality: htmlVideoElement => videoPlaybackQuality =
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLVideoElement/requestPictureInPicture)
*/
@send
external requestPictureInPicture: htmlVideoElement => Promise.t<pictureInPictureWindow> =
external requestPictureInPicture: htmlVideoElement => promise<pictureInPictureWindow> =
"requestPictureInPicture"

/**
Expand Down
10 changes: 5 additions & 5 deletions src/DOMAPI/Navigator.res
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ open WebMIDIAPI
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Navigator/setAppBadge)
*/
@send
external setAppBadge: (navigator, ~contents: int=?) => Promise.t<unit> = "setAppBadge"
external setAppBadge: (navigator, ~contents: int=?) => promise<unit> = "setAppBadge"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Navigator/clearAppBadge)
*/
@send
external clearAppBadge: navigator => Promise.t<unit> = "clearAppBadge"
external clearAppBadge: navigator => promise<unit> = "clearAppBadge"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Navigator/registerProtocolHandler)
Expand Down Expand Up @@ -74,7 +74,7 @@ external requestMediaKeySystemAccess: (
navigator,
~keySystem: string,
~supportedConfigurations: array<mediaKeySystemConfiguration>,
) => Promise.t<mediaKeySystemAccess> = "requestMediaKeySystemAccess"
) => promise<mediaKeySystemAccess> = "requestMediaKeySystemAccess"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Navigator/getGamepads)
Expand All @@ -98,7 +98,7 @@ external vibrate2: (navigator, array<int>) => bool = "vibrate"
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Navigator/share)
*/
@send
external share: (navigator, ~data: shareData=?) => Promise.t<unit> = "share"
external share: (navigator, ~data: shareData=?) => promise<unit> = "share"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Navigator/canShare)
Expand All @@ -110,5 +110,5 @@ external canShare: (navigator, ~data: shareData=?) => bool = "canShare"
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Navigator/requestMIDIAccess)
*/
@send
external requestMIDIAccess: (navigator, ~options: midiOptions=?) => Promise.t<midiAccess> =
external requestMIDIAccess: (navigator, ~options: midiOptions=?) => promise<midiAccess> =
"requestMIDIAccess"
6 changes: 3 additions & 3 deletions src/DOMAPI/VideoFrame.res
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ external copyTo: (
videoFrame,
~destination: ArrayBuffer.t,
~options: videoFrameCopyToOptions=?,
) => Promise.t<array<planeLayout>> = "copyTo"
) => promise<array<planeLayout>> = "copyTo"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/VideoFrame/copyTo)
Expand All @@ -86,7 +86,7 @@ external copyTo2: (
videoFrame,
~destination: sharedArrayBuffer,
~options: videoFrameCopyToOptions=?,
) => Promise.t<array<planeLayout>> = "copyTo"
) => promise<array<planeLayout>> = "copyTo"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/VideoFrame/copyTo)
Expand All @@ -96,7 +96,7 @@ external copyTo3: (
videoFrame,
~destination: DataView.t,
~options: videoFrameCopyToOptions=?,
) => Promise.t<array<planeLayout>> = "copyTo"
) => promise<array<planeLayout>> = "copyTo"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/VideoFrame/clone)
Expand Down
Loading
Loading