<div dir="ltr"><br><div class="gmail_extra">On 16 November 2013 17:13, Lionel Laské <span dir="ltr"><<a href="mailto:lionel@olpc-france.org" target="_blank">lionel@olpc-france.org</a>></span> wrote:<br><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="im"><div class="gmail_extra"><div class="gmail_quote">2013/11/16 Daniel Narvaez <span dir="ltr"><<a href="mailto:dwnarvaez@gmail.com" target="_blank">dwnarvaez@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><br></div></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">

<div class="gmail_extra"><div class="gmail_quote"><div>Okay. I guessed it was use as a way to detect Sugar Linux or Sugar Web but I didn't figure how. To hack it I've forced the creation of the sugar object (<a href="https://github.com/llaske/SugarWebUI/blob/master/lib/sugar-web/bus.js#L2" target="_blank">https://github.com/llaske/SugarWebUI/blob/master/lib/sugar-web/bus.js#L2</a>) but I'm not very happy with it.<span><font color="#888888"></font></span></div>


</div></div></div></blockquote><div><br></div></div><div> Do you have any plan on how to implement datastore? To known that even just vaguely would be helpful in suggesting how to deal with bus.js/environment.js...<br></div>

</div>
</div></div>
</blockquote></div><br></div></div><div class="gmail_extra">Not sure I will success but my idea is to reuse the current datastore.js and just hack bus.js to answer to datastore.js request using the LocalStorage instead of web socket.</div>
</div></blockquote><div><br></div><div>Maybe it's easier to hack datastore.js directly, keeping the same API.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br><div dir="ltr"><div class="gmail_extra">You could help me explaining more when and where the activityid and datastore objectid are generated and used in the Sugar Linux version. So I could try to emulate it.</div></div>
</blockquote><div><br></div><div>When you start an activity for the first time, the shell generates a random activityId. It passed it on the the command line to the python activity. The activity loads the html page then runs something like this in its js context<br>
<br>window.sugar.environment = {activityId:...};<br><br></div><div>The js activity retrieves it using env.getEnvironment(). It also creates a datastore object and put activityId in its metadata (the objectId is generated and returned by the datastore).<br>
<br></div><div>When you resume an activity, the shell has a datastore object. It gets objectId and activityId from it and send them to the js activity through the environment as I explained above.<br><br></div><div>Happy to clarify if something doesn't make sense in the explanation :)<br>
</div></div></div></div>