Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Last active October 2, 2018 18:00
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/dc52515ce0c60d6539693e145ddbf93f to your computer and use it in GitHub Desktop.
Save kenwebb/dc52515ce0c60d6539693e145ddbf93f to your computer and use it in GitHub Desktop.
The Love Letter - Helen - PostMessage
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Tue Oct 02 2018 14:00:20 GMT-0400 (Eastern Daylight Time)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: The Love Letter - Helen - PostMessage
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName: dc52515ce0c60d6539693e145ddbf93f based on 9fce004c2e5389e60424 b684ec7bab639ba548db 9460309abdef48f184cf
Keywords:
My Notes
--------
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".
It's possible to create an Avatar in either the Helen or the Jake app, and direct the Avatar to visit the other app.
If the Avatar is inside Helen, to move it to Jake in the other app:
go port1
The same Avatar command works to move the Avatar from Jake to Helen.
The Helen and Jake apps use the <Animate/> node to allow users to watch the two apps.
References
----------
(1) http://www.primordion.com/Xholon/gwt/wb/editwb.html?app=???????&src=gist
Jake's world
(2) http://en.wikipedia.org/wiki/Jack_Finney
(3) http://richters-time.blogspot.ca/2007/09/love-letter-by-jack-finney.html
(4) http://en.wikipedia.org/wiki/The_Love_Letter_%281998_film%29
(5) https://developer.mozilla.org/en-US/docs/Web/API/Window.postMessage
"The window.postMessage method safely enables cross-origin communication",
which sounds a lot like Jake and Helen's problem.
]]></Notes>
<_-.XholonClass>
<NoBoundariesSystem/>
<Helen/>
<Letter superClass="Attribute_String"/>
<Letters/>
</_-.XholonClass>
<xholonClassDetails>
<Helen xhType="XhtypePureActiveObject">
<port name="port" index="0" connector="../Letters/Letter"/>
<!-- localPortName, remoteXPathExpr, remoteWindowName, remoteUrl, useIframe -->
<!--<port name="port" index="1" connector="RemoteNodeService-PostMessage,1,NoBoundariesSystem/Jake,Jake,?app=The%20Love%20Letter%20-%20Jake%20-%20PostMessage&amp;src=lstr&amp;gui=clsc,false"/>-->
<!--<port name="port" index="1" connector="RemoteNodeService-MessageChannel,1,NoBoundariesSystem/Jake,Jake,?app=The%20Love%20Letter%20-%20Jake%20-%20PostMessage&amp;src=lstr&amp;gui=none,true"/>-->
<port name="port" index="1" connector="RemoteNodeService-MessageChannel,1,NoBoundariesSystem/Jake,Jake,?app=80324485c0e348da6046cca2442b8153&amp;src=gist&amp;gui=none,true"/>
</Helen>
<Avatar><Color>red</Color></Avatar>
</xholonClassDetails>
<NoBoundariesSystem>
<Helen/>
<Letters>
<Letter date="May 14, 1882"><![CDATA[
Dearest! Papa, Mamma, Willy and Cook are long retired and to sleep. Now, the night far advanced, the house silent, I alone remain awake,at last free to speak to you as I choose. Yes, I am willing to say it! Heart of mine, I crave your bold glance, I long for the tender warmth of your look; I welcome your ardency, and prize it; for what else should these be taken but sweet tribute to me?
Dear one:Do not ever change your ways. Never address me other than with what consideration my utterances should deserve. If I be foolish and whimsical, deride me sweetly if you will. But if I speak with seriousness, respond always with what care you deem my thoughts worthy.For, oh my beloved, I am sick to death of the indulgent smile and tolerant glance with which a woman's fancies are met.As I am repelled by the false gentleness and nicety of manner which too often ill conceal the wantonness they attempt to mask.I speak of the man I am to marry; if you could but save me from that!
But you cannot. You are everything I prize; warmly and honestly ardent, respectful in heart as well as in manner, true and loving.You are as I wish you to be — for you exist only in my mind. But figment though you are, and though I shall never see your like,you are more dear to me than he to whom I am betrothed.
I think of you constantly. I dream of you. I speak with you, in my mind and heart; would you existed outside them! Sweetheart, good night; dream of me, too.
With all my love,
I am,
your HELEN
Miss Helen Elizabeth Worley, Brooklyn, New York
]]></Letter>
<Letter><![CDATA[
Please, oh, please — who are you? Where can I reach you? Your letter arrived today in the second morning post, and I have wandered the house and garden ever since in an agony of excitement. I cannot conceive how you saw my letter in its secret place, but since you did, perhaps you will see this one too. Oh, tell me your letter is no hoax or cruel joke! Willy, if it is you; if you have discovered my letter and think to deceive your sister with a prank, I pray you to tell me! But if it is not —— if I now address someone who has truly responded to my most secret hopes — do not longer keep me ignorant of who and where you are. For I, too — and I confess it willingly — long to see you! And I, too, feel and am most certain of it, that if I could know you, I would love you. It is impossible for me to think otherwise.
I must hear from you again; I shall not rest until I do.
I remain, most sincerely,
HELEN ELIZABETH WORLEY
]]></Letter>
<Letter><![CDATA[
I will never forget.
]]></Letter>
</Letters>
<Animate duration="2" selection="#xhgraph" xpath="./NoBoundariesSystem" cssStyle=".d3cpnode circle {stroke-width: 0px;}" efParams="{&quot;selection&quot;:&quot;#xhgraph&quot;,&quot;sort&quot;:&quot;disable&quot;,&quot;width&quot;:300,&quot;height&quot;:300,&quot;mode&quot;:&quot;tween&quot;,&quot;labelContainers&quot;:true,&quot;includeId&quot;:true,&quot;shape&quot;:&quot;circle&quot;}"/>
<InteractionsViewer/>
</NoBoundariesSystem>
<NoBoundariesSystembehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var sys;
var beh = {
postConfigure: function() {
sys = this.cnode.parent();
$wnd.xh.param("TimeStep", "18820001");
$wnd.xh.param("InformationFile","http://en.wikipedia.org/wiki/The_Love_Letter_%281998_film%29");
}
}
//# sourceURL=NoBoundariesSystembehavior.js
]]></NoBoundariesSystembehavior>
<Helenbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var helen, jake, letter;
var beh = {
postConfigure: function() {
helen = this.cnode.parent();
jake = null;
letter = helen.port(0);
},
act: function() {
if (jake && letter) {
jake = helen.port(1); // update what jake points to
jake.msg(101, letter.text(), helen);
letter = letter.next();
}
},
processReceivedMessage: function(msg) {
switch (msg.signal) {
case 102: // response letter from Jake
helen.println("\n\nHelen has received a message (signal:" + msg.signal + ") from "
+ msg.sender.xhc().name() + ":\n" + msg.data);
break;
case -11: // ready message from the Jake window ISignal.SIGNAL_READY; TODO do this entirely within the IRemoteNode nodes
$wnd.console.log("Helen received ready message (-11) from Jake");
jake = helen.port(1); // this is temporary, until Helen sends a msg to Jake
$wnd.console.log(jake.name());
break;
default:
$wnd.console.log("Helen received unexpected signal: " + msg.signal);
break;
}
}
}
//# sourceURL=Helenbehavior.js
]]></Helenbehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg">
<g>
<title>Helen</title>
<rect id="NoBoundariesSystem/Helen" fill="#98FB98" height="50" width="50" x="25" y="0"/>
</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