iframe

class trame.widgets.iframe.Communicator(event_names=[], **kwargs)

Bases: AbstractElement

post_message(msg)

Post a message to the iframe. The message can be anything. When the target is a iframe.IFrame(), we will only handle the following format:

  1. { emit: ‘message-topic’, value: { a: 1, b: 2} } will trigger message_topic= event if properly registered in event_names=[‘message_topic’]

class trame.widgets.iframe.IFrame(event_names=[], **kwargs)

Bases: AbstractElement

post_message(msg)

Post a message to the iframe. The message can be anything. When the target is a iframe.Communicator(), we will only handle the following 2 format:

  1. { emit: ‘message-topic’, value: { a: 1, b: 2} } will trigger message_topic= event if properly registered in event_names=[‘message_topic’]

  2. { state: { a: 1, b: 2 } } will update the trame shared state