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

feat(react-dom): add experimental module #849

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

r17x
Copy link
Contributor

@r17x r17x commented Jul 19, 2024

What's

Binding experimental features module for react-dom.

list of experimental bind:

  • preconnect
  • prefetchDNS
  • preinit
  • preinitModule
  • preload
  • preloadModule

Usages

ReactDOM.Experimental.preconnect("https://example.com");

ReactDOM.Experimental.prefetchDNS("https://example.com");

ReactDOM.Experimental.preinit("https://example.com", ());

ReactDOM.Experimental.preinit(
  "https://example.com",
  ~options=ReactDOM.Experimental.preinitOptions(~_as=`style, ()),
  (),
);

ReactDOM.Experimental.preload("https://example.com", ());

ReactDOM.Experimental.preload("", ());

ReactDOM.Experimental.preload(
  "https://example.com",
  ~options=ReactDOM.Experimental.preloadOptions(~_as=`object_, ()),
  (),
);

ReactDOM.Experimental.preload(
  "https://example.com",
  ~options=
    ReactDOM.Experimental.preloadOptions(
      ~_as=`object_,
      ~fetchPriority=`auto,
      ~integrity="",
      ~referrerPolicy=`noReferrerWhenDowngrade,
      (),
    ),
  (),
);

ReactDOM.Experimental.preinitModule("https://example.com", ());

ReactDOM.Experimental.preinitModule(
  "https://example.com",
  ~options=
    ReactDOM.Experimental.preOptions(
      ~_as=`script,
      ~crossOrigin="use-credentials",
      ~nonce="8IBTHwOdqNKAWeKl7plt8g==",
      ~integrity=
        "sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC",
      (),
    ),
  (),
);

See playground

src/ReactDOM.rei Show resolved Hide resolved
src/ReactDOM.rei Outdated Show resolved Hide resolved
src/ReactDOM.rei Outdated Show resolved Hide resolved
@r17x r17x force-pushed the feat/experimental/react-dom branch from 8f6f928 to bb2fafe Compare July 21, 2024 06:50
src/ReactDOM.re Outdated Show resolved Hide resolved
src/ReactDOM.re Outdated Show resolved Hide resolved
r17x added 2 commits July 21, 2024 14:45
list of experimental bind:
* preconnect
* prefetchDNS
* preinit
* preinitModule
* preload
* preloadModule
@r17x r17x force-pushed the feat/experimental/react-dom branch from bb2fafe to 57d426b Compare July 21, 2024 07:46
src/ReactDOM.re Outdated Show resolved Hide resolved
@r17x r17x force-pushed the feat/experimental/react-dom branch from 24f04c7 to 26e7c3c Compare July 21, 2024 19:53
@r17x r17x requested a review from davesnx July 21, 2024 20:12
module Experimental = {
type preloadOptions;

[@mel.obj]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using [@mel.obj] in preloadOptions because wants to use [@mel.as] when polyvar contains preserved keyword and included -.

@r17x
Copy link
Contributor Author

r17x commented Jul 21, 2024

Updated usages in PR Description.

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