animation.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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 {
  6. Arg,
  7. RetVal,
  8. generateActorSpec,
  9. types
  10. } = require("devtools/shared/protocol");
  11. require("devtools/shared/specs/inspector");
  12. /**
  13. * Sent with the 'mutations' event as part of an array of changes, used to
  14. * inform fronts of the type of change that occured.
  15. */
  16. types.addDictType("animationMutationChange", {
  17. // The type of change ("added" or "removed").
  18. type: "string",
  19. // The changed AnimationPlayerActor.
  20. player: "animationplayer"
  21. });
  22. const animationPlayerSpec = generateActorSpec({
  23. typeName: "animationplayer",
  24. events: {
  25. "changed": {
  26. type: "changed",
  27. state: Arg(0, "json")
  28. }
  29. },
  30. methods: {
  31. release: { release: true },
  32. getCurrentState: {
  33. request: {},
  34. response: {
  35. data: RetVal("json")
  36. }
  37. },
  38. pause: {
  39. request: {},
  40. response: {}
  41. },
  42. play: {
  43. request: {},
  44. response: {}
  45. },
  46. ready: {
  47. request: {},
  48. response: {}
  49. },
  50. setCurrentTime: {
  51. request: {
  52. currentTime: Arg(0, "number")
  53. },
  54. response: {}
  55. },
  56. setPlaybackRate: {
  57. request: {
  58. currentTime: Arg(0, "number")
  59. },
  60. response: {}
  61. },
  62. getFrames: {
  63. request: {},
  64. response: {
  65. frames: RetVal("json")
  66. }
  67. },
  68. getProperties: {
  69. request: {},
  70. response: {
  71. properties: RetVal("array:json")
  72. }
  73. }
  74. }
  75. });
  76. exports.animationPlayerSpec = animationPlayerSpec;
  77. const animationsSpec = generateActorSpec({
  78. typeName: "animations",
  79. events: {
  80. "mutations": {
  81. type: "mutations",
  82. changes: Arg(0, "array:animationMutationChange")
  83. }
  84. },
  85. methods: {
  86. setWalkerActor: {
  87. request: {
  88. walker: Arg(0, "domwalker")
  89. },
  90. response: {}
  91. },
  92. getAnimationPlayersForNode: {
  93. request: {
  94. actorID: Arg(0, "domnode")
  95. },
  96. response: {
  97. players: RetVal("array:animationplayer")
  98. }
  99. },
  100. stopAnimationPlayerUpdates: {
  101. request: {},
  102. response: {}
  103. },
  104. pauseAll: {
  105. request: {},
  106. response: {}
  107. },
  108. playAll: {
  109. request: {},
  110. response: {}
  111. },
  112. toggleAll: {
  113. request: {},
  114. response: {}
  115. },
  116. toggleSeveral: {
  117. request: {
  118. players: Arg(0, "array:animationplayer"),
  119. shouldPause: Arg(1, "boolean")
  120. },
  121. response: {}
  122. },
  123. setCurrentTimes: {
  124. request: {
  125. players: Arg(0, "array:animationplayer"),
  126. time: Arg(1, "number"),
  127. shouldPause: Arg(2, "boolean")
  128. },
  129. response: {}
  130. },
  131. setPlaybackRates: {
  132. request: {
  133. players: Arg(0, "array:animationplayer"),
  134. rate: Arg(1, "number")
  135. },
  136. response: {}
  137. }
  138. }
  139. });
  140. exports.animationsSpec = animationsSpec;