[Sugar-devel] How do you save stuff in web activities?
Daniel Narvaez
dwnarvaez at gmail.com
Sat Mar 22 03:36:29 EDT 2014
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/9e300a63/attachment-0001.html>
More information about the Sugar-devel
mailing list