styleeditor.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. "use strict";
  5. const { Arg, RetVal, generateActorSpec } = require("devtools/shared/protocol");
  6. const oldStyleSheetSpec = generateActorSpec({
  7. typeName: "old-stylesheet",
  8. events: {
  9. "property-change": {
  10. type: "propertyChange",
  11. property: Arg(0, "string"),
  12. value: Arg(1, "json")
  13. },
  14. "source-load": {
  15. type: "sourceLoad",
  16. source: Arg(0, "string")
  17. },
  18. "style-applied": {
  19. type: "styleApplied"
  20. }
  21. },
  22. methods: {
  23. toggleDisabled: {
  24. response: { disabled: RetVal("boolean")}
  25. },
  26. fetchSource: {},
  27. update: {
  28. request: {
  29. text: Arg(0, "string"),
  30. transition: Arg(1, "boolean")
  31. }
  32. }
  33. }
  34. });
  35. exports.oldStyleSheetSpec = oldStyleSheetSpec;
  36. const styleEditorSpec = generateActorSpec({
  37. typeName: "styleeditor",
  38. events: {
  39. "document-load": {
  40. type: "documentLoad",
  41. styleSheets: Arg(0, "array:old-stylesheet")
  42. }
  43. },
  44. method: {
  45. newDocument: {},
  46. newStyleSheet: {
  47. request: { text: Arg(0, "string") },
  48. response: { styleSheet: RetVal("old-stylesheet") }
  49. }
  50. }
  51. });
  52. exports.styleEditorSpec = styleEditorSpec;