Skip to content

Commit

Permalink
Docs: Hybrid Execution
Browse files Browse the repository at this point in the history
  • Loading branch information
georgestagg committed Jul 28, 2024
1 parent 7387adb commit 169b5d5
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 26 deletions.
2 changes: 1 addition & 1 deletion docs/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ website:
- interactive/reactivity.qmd
- interactive/data.qmd
- interactive/dynamic.qmd
- interactive/define.qmd
- interactive/hybrid.qmd
- section: Other Features
contents:
- other/tables.qmd
Expand Down
25 changes: 0 additions & 25 deletions docs/interactive/define.qmd

This file was deleted.

54 changes: 54 additions & 0 deletions docs/interactive/hybrid.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: Hybrid Execution
subtitle: Combine pre-rendered and client-side WebAssembly computation
format: live-html
engine: knitr
---

{{< include ../_extensions/live/_knitr.qmd >}}

Defining variables through OJS variables allows for a communication channel between various execution engines.

## Build-time code execution

Data can be evaluated and exported to be made availabe to OJS blocks at runtime, using Quarto's usual build-time code cell execution.

#### Source
````{.markdown filename="hybrid.qmd"}
```{{r}}
library(ggplot2)
glimpse(diamonds)
ojs_define(diamonds)
```
````

#### Output
```{r}
library(ggplot2)
head(diamonds)
ojs_define(diamonds)
```

## Runtime computation

### OJS Cells

```{ojs}
diamonds
```

### WebAssembly `quarto-live` cells

````{.markdown filename="hybrid.qmd"}
```{{webr}}
#| input:
#| - diamonds
head(diamonds)
```
````

```{webr}
#| input:
#| - diamonds
head(diamonds)
```

0 comments on commit 169b5d5

Please sign in to comment.