Open arnaud-feldmann opened 3 months ago
However before the loading, the R functions lead to OJS runtime errors. Is there a way to disable these ones ?
No, but it is likely that in the future we'll try to replace the error message with something more informative, letting the user know that the WebAssembly engine is still loading and to wait.
This writes nothing and gets replaced when webr is loaded. Hence avoiding runtime errors. However, it looks like an ugly patch.
I know it seems strange, but I can't think of a better way to handle this with Observable itself. IIUC even Quarto has to make some tweaks to hide these kind of error messages as the page loads.
It does seem like this is the idiomatic way to do this in OJS. See, for example, the example notebook about how to catch errors: https://observablehq.com/d/43fb4c8c2f600135
Here is how I would implement it in Quarto Live, by adding an extra mutable
variable to the first line of the block:
```{ojs}
//| echo: false
mutable ok_reponse = (reponse, n) => { return html`Loading...` };
viewof reponse = Inputs.radio(
new Map([
["On n'utilise que des procédures (des fonctions sans valeur de retour).", 1],
["On n'utilise que des fonctions dites pures, c'est-à-dire des fonctions purement combinatoires.", 2],
["On n'utilise que des fonctions, pures ou non.", 3],
["Différentes étapes successives qu'on appelle fonctions. On les applique sur des objets qu'elles modifient progressivement.", 4]
])
);
ok_reponse(reponse, 2);
I think the above could possibly even be implemented automatically as part of the quarto-live filter, I will have a think about how best to do so.
I've discovered the webr/ojs interactivity possibilities. It's nice. I've tested something like that :