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.

82 lines
1.9 KiB

  1. define(["sugar-web/env"], function (env) {
  2. 'use strict';
  3. var bus = {};
  4. function WebSocketClient(environment) {
  5. }
  6. WebSocketClient.prototype.send = function (data) {
  7. };
  8. WebSocketClient.prototype.close = function () {
  9. };
  10. function InputStream() {
  11. }
  12. InputStream.prototype.open = function (callback) {
  13. };
  14. InputStream.prototype.read = function (count, callback) {
  15. };
  16. InputStream.prototype.gotData = function (buffer) {
  17. };
  18. InputStream.prototype.close = function (callback) {
  19. };
  20. function OutputStream() {
  21. }
  22. OutputStream.prototype.open = function (callback) {
  23. };
  24. OutputStream.prototype.write = function (data) {
  25. };
  26. OutputStream.prototype.close = function (callback) {
  27. };
  28. bus.createInputStream = function (callback) {
  29. };
  30. bus.createOutputStream = function (callback) {
  31. };
  32. bus.sendMessage = function (method, params, callback) {
  33. if (method == "activity.close") {
  34. window.location = "../../index.html";
  35. } else if (method == "activity.get_xo_color") {
  36. var color = {stroke: "#FF2B34", fill: "#005FE4"};
  37. if (typeof chrome != 'undefined' && chrome.app && chrome.app.runtime) {
  38. chrome.storage.local.get("sugar_settings", function(values) {
  39. color = JSON.parse(values.sugar_settings).colorvalue;
  40. callback(null, [[color.stroke, color.fill]]);
  41. });
  42. } else if (typeof(Storage)!=="undefined" && typeof(window.localStorage)!=="undefined") {
  43. try {
  44. color = JSON.parse(window.localStorage.getItem("sugar_settings")).colorvalue;
  45. } catch(err) {}
  46. }
  47. callback(null, [[color.stroke, color.fill]]);
  48. }
  49. return;
  50. };
  51. bus.onNotification = function (method, callback) {
  52. };
  53. bus.sendBinary = function (buffer, callback) {
  54. };
  55. bus.listen = function (customClient) {
  56. };
  57. bus.close = function () {
  58. };
  59. return bus;
  60. });