-
Notifications
You must be signed in to change notification settings - Fork 9
refactor: move runtime capability access away from Global window and navigator #247
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
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f007a57
refactor(runtime): move capability access off Global
jderochervlk 90e2afe
refactor(runtime): spread exported root type aliases
jderochervlk 03e057d
merge: update issue-241-runtime-access with pre-alpha
jderochervlk 86708c6
style: apply rescript formatter in issue-241 workspace
jderochervlk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,31 @@ | ||
| open ClipboardTypes | ||
|
|
||
| include EventTarget.Impl({type t = clipboard}) | ||
| type t = ClipboardTypes.clipboard = {...ClipboardTypes.clipboard} | ||
|
|
||
| external current: t = "clipboard" | ||
|
|
||
| include EventTarget.Impl({type t = t}) | ||
|
|
||
| /** | ||
| [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Clipboard/read) | ||
| */ | ||
| @send | ||
| external read: clipboard => promise<array<clipboardItem>> = "read" | ||
| external read: t => promise<array<clipboardItem>> = "read" | ||
|
|
||
| /** | ||
| [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Clipboard/readText) | ||
| */ | ||
| @send | ||
| external readText: clipboard => promise<string> = "readText" | ||
| external readText: t => promise<string> = "readText" | ||
|
|
||
| /** | ||
| [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Clipboard/write) | ||
| */ | ||
| @send | ||
| external write: (clipboard, array<clipboardItem>) => promise<unit> = "write" | ||
| external write: (t, array<clipboardItem>) => promise<unit> = "write" | ||
|
|
||
| /** | ||
| [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Clipboard/writeText) | ||
| */ | ||
| @send | ||
| external writeText: (clipboard, string) => promise<unit> = "writeText" | ||
| external writeText: (t, string) => promise<unit> = "writeText" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,31 @@ | ||
| open CredentialManagementTypes | ||
|
|
||
| type t = CredentialManagementTypes.credentialsContainer = { | ||
| ...CredentialManagementTypes.credentialsContainer, | ||
| } | ||
|
|
||
| external current: t = "credentials" | ||
|
|
||
| /** | ||
| [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CredentialsContainer/get) | ||
| */ | ||
| @send | ||
| external get: (credentialsContainer, ~options: credentialRequestOptions=?) => promise<credential> = | ||
| "get" | ||
| external get: (t, ~options: credentialRequestOptions=?) => promise<credential> = "get" | ||
|
|
||
| /** | ||
| [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CredentialsContainer/store) | ||
| */ | ||
| @send | ||
| external store: (credentialsContainer, credential) => promise<unit> = "store" | ||
| external store: (t, credential) => promise<unit> = "store" | ||
|
|
||
| /** | ||
| [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CredentialsContainer/create) | ||
| */ | ||
| @send | ||
| external create: ( | ||
| credentialsContainer, | ||
| ~options: credentialCreationOptions=?, | ||
| ) => promise<credential> = "create" | ||
| external create: (t, ~options: credentialCreationOptions=?) => promise<credential> = "create" | ||
|
|
||
| /** | ||
| [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CredentialsContainer/preventSilentAccess) | ||
| */ | ||
| @send | ||
| external preventSilentAccess: credentialsContainer => promise<unit> = "preventSilentAccess" | ||
| external preventSilentAccess: t => promise<unit> = "preventSilentAccess" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,35 @@ | ||
| open HistoryTypes | ||
|
|
||
| type t = HistoryTypes.history = {...HistoryTypes.history} | ||
|
|
||
| external current: t = "history" | ||
|
|
||
| /** | ||
| [Read more on MDN](https://developer.mozilla.org/docs/Web/API/History/go) | ||
| */ | ||
| @send | ||
| external go: (history, ~delta: int=?) => unit = "go" | ||
| external go: (t, ~delta: int=?) => unit = "go" | ||
|
|
||
| /** | ||
| [Read more on MDN](https://developer.mozilla.org/docs/Web/API/History/back) | ||
| */ | ||
| @send | ||
| external back: history => unit = "back" | ||
| external back: t => unit = "back" | ||
|
|
||
| /** | ||
| [Read more on MDN](https://developer.mozilla.org/docs/Web/API/History/forward) | ||
| */ | ||
| @send | ||
| external forward: history => unit = "forward" | ||
| external forward: t => unit = "forward" | ||
|
|
||
| /** | ||
| [Read more on MDN](https://developer.mozilla.org/docs/Web/API/History/pushState) | ||
| */ | ||
| @send | ||
| external pushState: (history, ~data: JSON.t, ~unused: string, ~url: string=?) => unit = "pushState" | ||
| external pushState: (t, ~data: JSON.t, ~unused: string, ~url: string=?) => unit = "pushState" | ||
|
|
||
| /** | ||
| [Read more on MDN](https://developer.mozilla.org/docs/Web/API/History/replaceState) | ||
| */ | ||
| @send | ||
| external replaceState: (history, ~data: JSON.t, ~unused: string, ~url: string=?) => unit = | ||
| "replaceState" | ||
| external replaceState: (t, ~data: JSON.t, ~unused: string, ~url: string=?) => unit = "replaceState" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,11 @@ | ||
| open PermissionsTypes | ||
|
|
||
| type t = PermissionsTypes.permissions = {...PermissionsTypes.permissions} | ||
|
|
||
| external current: t = "permissions" | ||
|
|
||
| /** | ||
| [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Permissions/query) | ||
| */ | ||
| @send | ||
| external query: (permissions, permissionDescriptor) => promise<permissionStatus> = "query" | ||
| external query: (t, permissionDescriptor) => promise<permissionStatus> = "query" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,11 @@ | ||
| open ScreenWakeLockTypes | ||
|
|
||
| type t = ScreenWakeLockTypes.wakeLock = {...ScreenWakeLockTypes.wakeLock} | ||
|
|
||
| external current: t = "wakeLock" | ||
|
|
||
| /** | ||
| [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WakeLock/request) | ||
| */ | ||
| @send | ||
| external request: (wakeLock, ~type_: wakeLockType=?) => promise<wakeLockSentinel> = "request" | ||
| external request: (t, ~type_: wakeLockType=?) => promise<wakeLockSentinel> = "request" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,14 @@ | ||
| open ServiceWorkerTypes | ||
|
|
||
| include WorkerGlobalScope.Impl({type t = serviceWorkerGlobalScope}) | ||
| type t = ServiceWorkerTypes.serviceWorkerGlobalScope = { | ||
| ...ServiceWorkerTypes.serviceWorkerGlobalScope, | ||
| } | ||
|
|
||
| include WorkerGlobalScope.Impl({type t = t}) | ||
|
|
||
| /** | ||
| Forces the waiting service worker to become the active service worker. | ||
| [Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope/skipWaiting) | ||
| */ | ||
| @send | ||
| external skipWaiting: serviceWorkerGlobalScope => promise<unit> = "skipWaiting" | ||
| external skipWaiting: t => promise<unit> = "skipWaiting" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should add a short comment just explaining this pattern for future ref
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm planning on updating the readme and contributor docs to cover this once we're ready to finish tidying things up.