Hey everyone,
I recently experimented with comms:
display(HTML(
"""
<script>
var Comm =
Jupyter.notebook.kernel.comm_manager.new_comm(
"comm", {}
);
Comm.on_msg(function(msg) {
const data = msg.content.data;
console.log(data);
});
</script>
"""
))
def comm_target(comm, _):
@comm.on_msg
def receive(msg):
data = msg['content']['data']
comm.send(data)
self.ipy.kernel.comm_manager.register_target(
'comm', comm_target
)
Is it possible to execute JS in the receive
function? Somethin like display(Javascript('console.log("test")'))
? Because at the moment this does not work for me. I could send a message and execute the JS-Code in Comm.on_msg
but that is not exactly what I am looking for.
Thanks in advance!