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

Use postMessage to send messages between preview and element windows #1704

Merged
merged 4 commits into from
Jan 6, 2020

Conversation

tvdeyen
Copy link
Member

@tvdeyen tvdeyen commented Jan 3, 2020

window.postMessage is a safe and cross origin safe way to send serialized data between browser windows. In our case the preview iframe and the editing browser window.

That way we have a unified way to trigger events on both sides and truly separate concerns. Also this provides us a way to send more data in the future, aka. live updates of content.

A convenient way to send a postMessage to the preview iFrame.
We want to be able to post data with messages around. Since postMessage
uses a safe serialization internally we can just pass an object.
@tvdeyen tvdeyen merged commit 085773b into master Jan 6, 2020
@tvdeyen tvdeyen deleted the use-post-message branch January 6, 2020 21:07
tvdeyen added a commit that referenced this pull request Jan 8, 2020
- Fix updating page preview after element create/save [#1710](#1710) ([tvdeyen](https://github.com/tvdeyen))
- Element editor layout changes [#1709](#1709) ([tvdeyen](https://github.com/tvdeyen))
- Add Alchemy.user_class_primary_key setting [#1708](#1708) ([tvdeyen](https://github.com/tvdeyen))
- Add Element views upgrade tasks [#1707](#1707) ([tvdeyen](https://github.com/tvdeyen))
- Use postMessage to send messages between preview and element windows [#1704](#1704) ([tvdeyen](https://github.com/tvdeyen))
tvdeyen added a commit that referenced this pull request Jan 8, 2020
- Fix updating page preview after element create/save [#1710](#1710) ([tvdeyen](https://github.com/tvdeyen))
- Element editor layout changes [#1709](#1709) ([tvdeyen](https://github.com/tvdeyen))
- Add Alchemy.user_class_primary_key setting [#1708](#1708) ([tvdeyen](https://github.com/tvdeyen))
- Add Element views upgrade tasks [#1707](#1707) ([tvdeyen](https://github.com/tvdeyen))
- Use postMessage to send messages between preview and element windows [#1704](#1704) ([tvdeyen](https://github.com/tvdeyen))
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

Successfully merging this pull request may close these issues.

1 participant