aboutsummaryrefslogtreecommitdiffstats
path: root/site/main.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'site/main.mjs')
-rw-r--r--site/main.mjs29
1 files changed, 29 insertions, 0 deletions
diff --git a/site/main.mjs b/site/main.mjs
new file mode 100644
index 0000000..1457958
--- /dev/null
+++ b/site/main.mjs
@@ -0,0 +1,29 @@
+let type = 'pure';
+let alts = ['wasm'];
+switch (self.location.search) {
+case '?wasm':
+ type = 'wasm';
+ alts = ['pure'];
+ break;
+}
+const mod = `./${type}.mjs`;
+
+document.querySelectorAll('.subst-type').forEach(elt => {
+ elt.textContent = type;
+});
+document.querySelectorAll('.subst-alts').forEach(elt => {
+ const links = alts.map(t => {
+ const link = document.createElement('a');
+ link.setAttribute('href', `?${t}`);
+ link.textContent = t;
+ return link;
+ });
+ links.forEach(l => elt.appendChild(l));
+});
+
+async function loaded() {
+ const x = await import(mod);
+ await x.default();
+}
+
+document.addEventListener('DOMContentLoaded', loaded);