[Sugar-devel] A prototype of SugarWeb / SugarAndroid - Technical questions

Daniel Narvaez dwnarvaez at gmail.com
Sat Nov 16 14:00:08 EST 2013


On 16 November 2013 17:13, Lionel Laské <lionel at olpc-france.org> wrote:

> 2013/11/16 Daniel Narvaez <dwnarvaez at gmail.com>
>
>>
>> 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 (
>>> https://github.com/llaske/SugarWebUI/blob/master/lib/sugar-web/bus.js#L2)
>>> but I'm not very happy with it.
>>>
>>
>>  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...
>>
>
> 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.
>

Maybe it's easier to hack datastore.js directly, keeping the same API.


>
> 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.
>

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

window.sugar.environment = {activityId:...};

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).

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.

Happy to clarify if something doesn't make sense in the explanation :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20131116/02286a3f/attachment.html>


More information about the Sugar-devel mailing list