[Sugar-devel] Datastore API for html activities

Manuel Quiñones manuq at laptop.org
Mon May 27 20:14:39 EDT 2013


2013/5/27 Daniel Narvaez <dwnarvaez at gmail.com>:
> On 27 May 2013 22:16, Daniel Narvaez <dwnarvaez at gmail.com> wrote:
>>
>> Save an object
>>
>> textObject = datastore.TextObject();
>> textObject.setText("Hello");
>> textObject.setMetadata({"title": "hello"});
>> textObject.save(onWrote);
>>
>> Load an object
>>
>> textObject = datastore.TextObject();
>> textObject.load(onGotText);
>> textObject.getMetadata(onGotMetadata);
>>
>
> Probably StringObject would be less ambiguous than TextObject.

Great job!  I think TextObject and setText are better because denote a
text file.

Could it be possible to do the API with less callbacks?  Like:

var text = textObject.load();
var metadata = textObject.getMetadata();

--
.. manuq ..


More information about the Sugar-devel mailing list