Skip to content

Commit

Permalink
Enforce PostMessage channel in webR
Browse files Browse the repository at this point in the history
  • Loading branch information
georgestagg committed Dec 16, 2024
1 parent 2f11366 commit 51ec97f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion _extensions/live/templates/webr-setup.ojs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
webROjs = {
const { WebR } = window._exercise_ojs_runtime.WebR;
const { WebR, ChannelType } = window._exercise_ojs_runtime.WebR;
const {
WebREvaluator,
WebREnvironmentManager,
Expand Down Expand Up @@ -37,6 +37,10 @@ webROjs = {
const filesContent = document.querySelector(`script[type=\"vfs-file\"]`).textContent;
const files = JSON.parse(b64Decode(filesContent));

// Use PostMessage channel for async communication
// We do not expect to take nested prompt input in Quarto Live cells
data.options.channelType = ChannelType.PostMessage;

// Initialise webR and setup for R code evaluation
let webRPromise = (async (webR) => {
statusText.textContent = `Downloading webR`;
Expand Down

0 comments on commit 51ec97f

Please sign in to comment.