Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Last active April 18, 2020 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenwebb/cff05e29c779dea8afe777f7a3a1a9ad to your computer and use it in GitHub Desktop.
Save kenwebb/cff05e29c779dea8afe777f7a3a1a9ad to your computer and use it in GitHub Desktop.
Avatar acting on separate browser window
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Sat Apr 18 2020 05:50:40 GMT-0400 (Eastern Daylight Time)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Avatar acting on separate browser window
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName: cff05e29c779dea8afe777f7a3a1a9ad
Keywords:
My Notes
--------
April 17, 2020
An app whose system Avatar can access a Xholon app running in another browser window.
Both apps have the same domain (ex: localhost), and run in the same type of browser (ex: Firefox). They share an address space.
For ideas:
See my RemoteNodeService.
see my "The Love Letter" apps.
(1) http://localhost:8080/war/wb/editwb.html?app=80324485c0e348da6046cca2442b8153&src=gist
The Love Letter - Jake - PostMessage
September 24, 2018
This tests connecting separate Helen and Jake windows, using the RemoteNodeService with PostMessage.java.
Helen connects to Jake, while Jake listens for Helen's connection request.
Helen uses a "port", while Jake uses a "trop".
(2) http://localhost:8080/war/wb/editwb.html?app=dc52515ce0c60d6539693e145ddbf93f&src=gist
The Love Letter - Helen - PostMessage
(3) http://localhost:8080/war/wb/editwb.html?app=b684ec7bab639ba548db&src=gist
The Love Letter - Helen Elizabeth Worley
The technical challenge in this pair of workbooks is to figure out how to interact between apps running in two separate browser windows.
I'll use the HTML5 Window postMessage method[5].
see: Helenbehavior
(4) http://localhost:8080/war/wb/editwb.html?app=b82b688d02e6b9f06fef&src=gist
The Love Letter - Jake Belknap
see: Jakebehavior
(5) http://localhost:8080/war/wb/editwb.html?app=9460309abdef48f184cf&src=gist
The Love Letter - Helen - no postMessage()
This version of the Helen and Jake multi-app uses Xholon messaging, with no HTML postMessage().
This is possible because both the Helen window and the Jake window have the same domain, protocol and port.
The Helen window is the top window on the page, while the Jake window is an iframe or optionally on a separate page.
(6) http://localhost:8080/war/wb/editwb.html?app=81786af30c8ac62e4753&src=gist
The Love Letter - Jake - no postMessage()
This version of the Helen and Jake multi-app uses Xholon messaging, with no HTML postMessage().
This is possible because both the Helen window and the Jake window have the same domain, protocol and port.
The Helen window is the top window on the page, while the Jake window is an iframe or optionally on a separate page.
]]></Notes>
<_-.XholonClass>
<PhysicalSystem/>
<RController/>
</_-.XholonClass>
<xholonClassDetails>
<!--<Block>
<port name="height" connector="Height"/>
</Block>-->
</xholonClassDetails>
<PhysicalSystem>
<RController/>
</PhysicalSystem>
<RControllerbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var me, rwindow, lava, rava, beh = {
postConfigure: function() {
me = this.cnode.parent();
lava = $wnd.xh.avatar(); // local Avatar
lava.action("where;who;");
rava = null; // remote Avatar; do I need this:
// http://localhost:8080/war/Xholon.html?app=HelloWorld&gui=clsc
var url = location.protocol + "//" + location.hostname + (location.port ? ":" : "") + location.port + location.pathname + "?app=Cell" + "&gui=clsc";
rwindow = $wnd.open(url, "remote");
$wnd.console.log(rwindow);
lava.obj(rwindow.xh.root().first());
lava.action("where;who;look;"); // You are in hello_2.You are the system Avatar avatar_42.You are in hello_2. You see passage port0 to world_3
},
act: function() {
me.println(this.toString());
// TODO
},
toString: function() {
return "testing:";
}
}
//# sourceURL=RControllerbehavior.js
]]></RControllerbehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg">
<g>
<title>RController</title>
<rect id="PhysicalSystem/RController" fill="#98FB98" height="50" width="50" x="25" y="0"/>
<g>
<title>Height</title>
<rect id="PhysicalSystem/RController/RControllerbehavior" fill="#6AB06A" height="50" width="10" x="80" y="0"/>
</g>
</g>
</svg>
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient>
</XholonWorkbook>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment