forked from coatless-r-n-d/webR-quarto-demos
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathwebr-setup.html
25 lines (25 loc) · 873 Bytes
/
webr-setup.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.css">
<style>
.CodeMirror pre {
background-color: unset !important;
}
.btn-webr {
background-color: #EEEEEE;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/mode/r/r.js"></script>
<script type="module">
import { WebR } from "https://webr.r-wasm.org/v0.1.0/webr.mjs";
globalThis.webR = new WebR({
SW_URL: "/"
});
await globalThis.webR.init();
globalThis.webRCodeShelter = await new globalThis.webR.Shelter();
document.querySelectorAll(".btn-webr").forEach((btn) => {
btn.innerText = "Run code";
btn.disabled = false;
});
</script>