Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow communication between outputframes #19

Closed
blois opened this issue Jan 5, 2018 · 2 comments
Closed

Allow communication between outputframes #19

blois opened this issue Jan 5, 2018 · 2 comments

Comments

@blois
Copy link
Contributor

blois commented Jan 5, 2018

Trusted outputframes should be able to send and receive messages with other trusted outputframes.

This is to allow widgets in one outputframe to affect the visualization in another one.

@blois
Copy link
Contributor Author

blois commented Jan 5, 2018

The code would look something like:

// A callback invoked from other cells.
google.colab.registerListener('cell1', (id, data) => {
  // do something with data.
});

Then that method in one output would be able to be invoked from another cell's output:

google.colab.sendMessageToListeners('cell1', { text: 'hello world!' });

@blois
Copy link
Contributor Author

blois commented May 29, 2018

A better approach for this is to use the browser's BroadcastChannel to communicate between frames.

An example can be found at https://colab.research.google.com/notebooks/snippets/advanced_outputs.ipynb#scrollTo=8VlhVnsL-eKX

@blois blois closed this as completed May 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant