Here’s one approach (with slight modifications from your original import statements so that it works in Firefox):
The key cell is this one:
{
const hello = html``;
Runtime.load(notebook1, (variable) => {
if (variable.name === "canvas") return {
fulfilled: (value) => {
while (hello.firstChild) {
hello.removeChild(hello.firstChild);
}
hello.appendChild(value);
}
};
});
return hello;
}
I think what’s happening with your code is related to what @mootari described in this forum post. In particular, when the width
variable changes, the cell has to be re-evaluated, but the promise / minimal cell inspector that you were using doesn’t catch that.