[Sugar-devel] How do you save stuff in web activities?

Sam Parkinson sam.parkinson3 at gmail.com
Sat Mar 22 00:34:33 EDT 2014


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20140322/6acdeb03/attachment.html>


More information about the Sugar-devel mailing list