Skip to content
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

Add Js.globalThis object binding #6909

Merged
merged 2 commits into from
Jul 29, 2024

Conversation

cometkim
Copy link
Member

@cknitt
Copy link
Member

cknitt commented Jul 25, 2024

Ok for me to add this, just two remarks:

  1. We should then add it to Core, too.
  2. IMHO, in the docs, we should rather promote the practice of creating explicit bindings using globalThis, like
@scope("globalThis")
external window: option<Dom.window> = "window"

instead of using

Js.globalThis["window"]

@cometkim
Copy link
Member Author

at least Js.globalThis["window"] is better than %raw("window") 😉

@cometkim
Copy link
Member Author

cometkim commented Jul 26, 2024

We should then add it to Core, too.

We already have in https://github.com/rescript-association/rescript-core/blob/22642ea/src/RescriptCore.res#L49, but there is a mismatch in the window usecase

Reported to rescript-lang/rescript-core#240

@cometkim
Copy link
Member Author

I'm merging this, globalThis already in the Core with the same signature

@cometkim cometkim merged commit b16c66f into rescript-lang:master Jul 29, 2024
19 checks passed
@cometkim cometkim deleted the js-global-this branch July 29, 2024 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants