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

Upstream IPC: Web container => Jasonette #253

Merged
merged 1 commit into from
Aug 19, 2017
Merged

Upstream IPC: Web container => Jasonette #253

merged 1 commit into from
Aug 19, 2017

Conversation

gliechtenstein
Copy link
Contributor

This PR allows a web container to reach outside of its own sandbox and call its parent Jasonette native app's JASON actions, simply by calling:

JASON.call(/****JASON ACTION****/)

from its javascript. You just need to pass the same action JSON as an argument. Here's an example:

{
  "type": "html",
  "text": "<html><script>var t= {name: 'cat'}; JASON.call({trigger:\"add\",options:t})</script></html>"
}

Another example:

{
  "type": "html",
  "text": "<html><script>JASON.call({type:\"$util.alert\",options:{title: 'alert', description: 'this is an alert'}})</script></html>"
}

screen shot 2017-08-07 at 11 46 55 am


This is part 1 of the full IPC architecture as it addresses only the webcontainer ==> Jasonette direction communication.

The part 2, which is the opposite direction (Jasonette ==> web container), is much more complicated and involves introduction of multiple APIs since it needs ways to describe how to:

  1. Identify each web container component with a unique identifier
  2. Keep track of all the web containers that can be messaged
  3. Dispatch a Javascript function call to only the intended web container

Part 1 is already useful for many cases and it looks like Part 2 will take some time to figure out, which is why it's broken down into two parts. The part 2 will be a separate PR.

@maks
Copy link

maks commented Aug 11, 2017

@gliechtenstein would it be worth adding the above notes to the documentation issue for this ?

@gliechtenstein
Copy link
Contributor Author

@mak done:) Jasonette/documentation#66 (comment)

@gliechtenstein gliechtenstein merged commit 0541088 into develop Aug 19, 2017
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.

2 participants