Thank you Sam. Could I ask a follow up question, as the help guide isn’t very clear to me:
How do I pass several variable values from my page code to the HTML element?
I have this in my page code:
export function LSlider_change(event) {
//Add your code for this event here:
//%Nozzle Throat Diameter:
let L = $w('#LSlider').value;
$w("#htmlThing").postMessage(L);
}
And this in my HTML code
<script>
function init () {
window.onmessage = (event) => {
if (event.data) {
let L = event.data;
}else{
let L = 0.002;
}
}
}
//rest of code happens after this, with a canvas element
//using the value of 'L' and other variables to define
//certain sizes.
</script>
Two questions:
- What am I doing wrong here? the code runs but I can’t seem to get anything that uses L to work.
- How do I pass more variables than just L into the HTML element?
Thanks for your help.