[Sugar-devel] How do you save stuff in web activities?
Sam Parkinson
sam.parkinson3 at gmail.com
Sat Mar 22 03:55:32 EDT 2014
Hi,
I am just calling this form "define(function(require)". You can see the
rest of the file here
https://github.com/SAMdroid-apps/sugar-slides/blob/master/js/activity.coffee
Thanks :)
On Sat, Mar 22, 2014 at 6:36 PM, Daniel Narvaez <dwnarvaez at gmail.com> wrote:
> Where are you calling this from? You should not need to setup() manually.
>
>
> On Saturday, 22 March 2014, Sam Parkinson <sam.parkinson3 at gmail.com>
> wrote:
>
>> Hi,
>>
>> I'm just wondering, does anyone have any code snippets for saving on web
>> activities?
>>
>> I'm trying to make a web activity and am having some issues. Here is my
>> save+load code: [CoffeeScript]
>>
>> activity.setup()
>> datastoreObject = activity.getDatastoreObject()
>> onLoaded = (error, metadata, data) ->
>> alert data
>> obj = JSON.parse data
>> console.log obj
>> container.html obj.html
>> $('section').each (x, ele) ->
>> scribe_slide_setup ele
>> undefined
>> datastoreObject.loadAsText onLoaded
>>
>> activity.write = ->
>> obj =
>> html: container.html()
>> jsonData = JSON.stringify obj
>> datastoreObject.setDataAsText jsonData
>> datastoreObject.save()
>>
>> Neither methods end up getting called. I'm using 0.100.0.
>>
>> Thanks,
>> Sam
>>
>
>
> --
> Daniel Narvaez
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20140322/1ebc7fdc/attachment.html>
More information about the Sugar-devel
mailing list