not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.1 KiB

  1. define(["sugar-web/activity/activity","activity/moon-activity","webL10n"], function (activity, moonActivity, l10n) {
  2. // Manipulate the DOM only when it is ready.
  3. requirejs(['domReady!'], function (doc) {
  4. // Initialize the activity.
  5. activity.setup();
  6. moonActivity.setup();
  7. var datastoreObject = activity.getDatastoreObject();
  8. datastoreObject.loadAsText(function (error, metadata, data) {
  9. if (data == null) {
  10. return;
  11. }
  12. moonActivity.initPrefs(data);
  13. });
  14. var stopButton = document.getElementById("stop-button");
  15. stopButton.addEventListener('click', function (event) {
  16. var pref = moonActivity.getPrefs();
  17. datastoreObject.setDataAsText(pref);
  18. console.log("writing...");
  19. datastoreObject.save(function (error) {
  20. if (error === null) {
  21. console.log("write done.");
  22. }
  23. else {
  24. console.log("write failed.");
  25. }
  26. });
  27. });
  28. });
  29. });