Skip to content

Commit

Permalink
chore: use module script everywhere w/ top-level-await (#3803)
Browse files Browse the repository at this point in the history
- Uniformize/simplify all HTML sample w/ top-level-awaits & type=module.
- Unformize all usage of `url()` CSS function to use root-based URL.

---------

Co-authored-by: GitHub Actions Bot <>
  • Loading branch information
louis-bompart authored Apr 17, 2024
1 parent fc4be2e commit 313164d
Show file tree
Hide file tree
Showing 13 changed files with 201 additions and 625 deletions.
22 changes: 10 additions & 12 deletions packages/atomic-hosted-page/src/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@
<title>Coveo Atomic Hosted Page</title>

<script type="module" src="/build/atomic-hosted-page.esm.js"></script>
<script>
(async () => {
await customElements.whenDefined('atomic-hosted-page');
<script type="module">
await customElements.whenDefined('atomic-hosted-page');

const page = document.querySelector('atomic-hosted-page');
// TODO: switch for prod - searchuisamples
await page.initialize({
pageId: '88411b30-39fb-4bd3-8663-2d1af2b27659',
accessToken: 'xx71d82ce9-f6fe-4be0-9209-c0e43f6fae81',
organizationId: 'searchuisamples',
organizationEndpoints: await page.getOrganizationEndpoints('searchuisamples'),
});
})();
const page = document.querySelector('atomic-hosted-page');
// TODO: switch for prod - searchuisamples
await page.initialize({
pageId: '88411b30-39fb-4bd3-8663-2d1af2b27659',
accessToken: 'xx71d82ce9-f6fe-4be0-9209-c0e43f6fae81',
organizationId: 'searchuisamples',
organizationEndpoints: await page.getOrganizationEndpoints('searchuisamples'),
});
</script>
</head>
<body>
Expand Down
20 changes: 9 additions & 11 deletions packages/atomic-hosted-page/src/pages/simple-builder.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@
<title>Coveo Atomic Hosted Page</title>

<script type="module" src="/build/atomic-hosted-page.esm.js"></script>
<script>
(async () => {
await customElements.whenDefined('atomic-simple-builder');
<script type="module">
await customElements.whenDefined('atomic-simple-builder');

const builder = document.querySelector('atomic-simple-builder');
await builder.initialize({
interfaceId: '5be6b830-8605-40e4-8e7a-5c56aa7c750c',
accessToken: 'xx71d82ce9-f6fe-4be0-9209-c0e43f6fae81',
organizationId: 'searchuisamples',
organizationEndpoints: await builder.getOrganizationEndpoints('searchuisamples'),
});
})();
const builder = document.querySelector('atomic-simple-builder');
await builder.initialize({
interfaceId: '5be6b830-8605-40e4-8e7a-5c56aa7c750c',
accessToken: 'xx71d82ce9-f6fe-4be0-9209-c0e43f6fae81',
organizationId: 'searchuisamples',
organizationEndpoints: await builder.getOrganizationEndpoints('searchuisamples'),
});
</script>
</head>
<body>
Expand Down
Loading

0 comments on commit 313164d

Please sign in to comment.