view.js 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. /*
  2. The MIT License (MIT)
  3. Copyright (c) 2014-2020 Nikolai Suslov and the Krestianstvo.org project contributors. (https://github.com/NikolaySuslov/livecodingspace/blob/master/LICENSE.md)
  4. Virtual World Framework Apache 2.0 license (https://github.com/NikolaySuslov/livecodingspace/blob/master/licenses/LICENSE_VWF.md)
  5. */
  6. /// View API.
  7. ///
  8. /// @module vwf/api/view
  9. class ViewApi {
  10. constructor() {
  11. //console.log("View constructor");
  12. /// Description.
  13. ///
  14. /// @function
  15. ///
  16. /// @param {ID} nodeID
  17. /// @param {ID} childID
  18. /// @param {String} childExtendsID
  19. /// @param {String[]} childImplementsIDs
  20. /// @param {String} childSource
  21. /// @param {String} childType
  22. /// @param {String} childIndex
  23. /// When `nodeID` is falsy, the URI of the component, or `undefined` if the component
  24. /// wasn't loaded from a URI. When `nodeID` is truthy, the numerical index of the child's
  25. /// position in the parent's array, starting at `0`. When child order is significant to
  26. /// the driver, the child should be placed at the given position in the parent's array.
  27. /// Nodes won't necessarily arrive in numerical order since varying dependencies cause
  28. /// nodes to become ready at indeterminate times.
  29. /// @param {String} childName
  30. /// @param {module:vwf/api/view~readyCallback} callback
  31. ///
  32. /// @returns {}
  33. this.createdNode = [ /* nodeID, childID, childExtendsID, childImplementsIDs, childSource, childType,
  34. childIndex, childName, callback( ready ) */ ]
  35. /// Description.
  36. ///
  37. /// @function
  38. ///
  39. /// @param {ID} nodeID
  40. /// @param {ID} childID
  41. /// @param {String} childExtendsID
  42. /// @param {String[]} childImplementsIDs
  43. /// @param {String} childSource
  44. /// @param {String} childType
  45. /// @param {String} childIndex
  46. /// When `nodeID` is falsy, the URI of the component, or `undefined` if the component
  47. /// wasn't loaded from a URI. When `nodeID` is truthy, the numerical index of the child's
  48. /// position in the parent's array, starting at `0`. When child order is significant to
  49. /// the driver, the child should be placed at the given position in the parent's array.
  50. /// Nodes won't necessarily arrive in numerical order since varying dependencies cause
  51. /// nodes to become ready at indeterminate times.
  52. /// @param {String} childName
  53. ///
  54. /// @returns {}
  55. this.initializedNode = [ /* nodeID, childID, childExtendsID, childImplementsIDs, childSource, childType,
  56. childIndex, childName */ ]
  57. /// Description.
  58. ///
  59. /// @function
  60. ///
  61. /// @param {ID} nodeID
  62. ///
  63. /// @returns {}
  64. this.deletedNode = [ /* nodeID */ ]
  65. /// Description.
  66. ///
  67. /// @function
  68. ///
  69. /// @param {ID} nodeID
  70. /// @param {ID} childID
  71. /// @param {String} childName
  72. ///
  73. /// @returns {}
  74. this.addedChild = [ /* nodeID, childID, childName */ ]
  75. /// Description.
  76. ///
  77. /// @function
  78. ///
  79. /// @param {ID} nodeID
  80. /// @param {ID} childID
  81. ///
  82. /// @returns {}
  83. this.removedChild = [ /* nodeID, childID */ ]
  84. /// Description.
  85. ///
  86. /// @function
  87. ///
  88. /// @param {ID} nodeID
  89. /// @param {String} propertyName
  90. /// @param {Value} propertyValue
  91. ///
  92. /// @returns {}
  93. this.createdProperty = [ /* nodeID, propertyName, propertyValue */ ]
  94. /// Description.
  95. ///
  96. /// @function
  97. ///
  98. /// @param {ID} nodeID
  99. /// @param {String} propertyName
  100. /// @param {Value} propertyValue
  101. ///
  102. /// @returns {}
  103. this.initializedProperty = [ /* nodeID, propertyName, propertyValue */ ]
  104. // TODO: deletedProperty
  105. /// Description.
  106. ///
  107. /// @function
  108. ///
  109. /// @param {ID} nodeID
  110. /// @param {String} propertyName
  111. /// @param {Value} propertyValue
  112. /// The internal value of the property set in the model driver (which
  113. /// may differ from the value originally passed in to the model driver).
  114. ///
  115. /// @returns {}
  116. this.satProperty = [ /* nodeID, propertyName, propertyValue */ ]
  117. /// Description.
  118. ///
  119. /// @function
  120. ///
  121. /// @param {ID} nodeID
  122. /// @param {String} propertyName
  123. /// @param {Value} propertyValue
  124. ///
  125. /// @returns {}
  126. this.gotProperty = [ /* nodeID, propertyName, propertyValue */ ]
  127. /// Description.
  128. ///
  129. /// @function
  130. ///
  131. /// @param {ID} nodeID
  132. /// @param {String} methodName
  133. /// @param {String[]} methodParameters
  134. /// @param {String} methodBody
  135. ///
  136. /// @returns {}
  137. this.createdMethod = [ /* nodeID, methodName, methodParameters, methodBody */ ]
  138. // TODO: deletedMethod
  139. /// Description.
  140. ///
  141. /// @function
  142. ///
  143. /// @param {ID} nodeID
  144. /// @param {String} methodName
  145. /// @param {Handler} methodHandler
  146. ///
  147. /// @returns {}
  148. this.satMethod = [ /* nodeID, methodName, methodHandler */ ]
  149. /// Description.
  150. ///
  151. /// @function
  152. ///
  153. /// @param {ID} nodeID
  154. /// @param {String} methodName
  155. /// @param {Handler} methodHandler
  156. ///
  157. /// @returns {}
  158. this.gotMethod = [ /* nodeID, methodName, methodHandler */ ]
  159. /// Description.
  160. ///
  161. /// @function
  162. ///
  163. /// @param {ID} nodeID
  164. /// @param {String} methodName
  165. /// @param {String[]} methodParameters
  166. /// @param {Value} methodValue
  167. ///
  168. /// @returns {}
  169. this.calledMethod = [ /* nodeID, methodName, methodParameters, methodValue */ ]
  170. /// Description.
  171. ///
  172. /// @function
  173. ///
  174. /// @param {ID} nodeID
  175. /// @param {String} eventName
  176. /// @param {String[]} eventParameters
  177. ///
  178. /// @returns {}
  179. this.createdEvent = [ /* nodeID, eventName, eventParameters */ ]
  180. // TODO: deletedEvent
  181. /// Description.
  182. ///
  183. /// @function
  184. ///
  185. /// @param {ID} nodeID
  186. /// @param {String} eventName
  187. /// @param {ListenerID} eventListenerID
  188. /// @param {Handler} eventHandler
  189. /// @param {ID} eventContextID
  190. /// @param {String[]} eventPhases
  191. ///
  192. /// @returns {}
  193. this.addedEventListener = [ /* nodeID, eventName, eventListenerID, eventHandler, eventContextID, eventPhases */ ]
  194. /// Description.
  195. ///
  196. /// @function
  197. ///
  198. /// @param {ID} nodeID
  199. /// @param {String} eventName
  200. /// @param {ListenerID} eventListenerID
  201. ///
  202. /// @returns {}
  203. this.removedEventListener = [ /* nodeID, eventName, eventListenerID */ ]
  204. /// Description.
  205. ///
  206. /// @function
  207. ///
  208. /// @param {ID} nodeID
  209. /// @param {String} eventName
  210. /// @param {ListenerID} eventListenerID
  211. /// @param {Listener} eventListener
  212. ///
  213. /// @returns {}
  214. this.satEventListener = [ /* nodeID, eventName, eventListenerID, eventListener */ ]
  215. /// Description.
  216. ///
  217. /// @function
  218. ///
  219. /// @param {ID} nodeID
  220. /// @param {String} eventName
  221. /// @param {ListenerID} eventListenerID
  222. /// @param {Listener} eventListener
  223. ///
  224. /// @returns {}
  225. this.gotEventListener = [ /* nodeID, eventName, eventListenerID, eventListener */ ]
  226. /// Description.
  227. ///
  228. /// @function
  229. ///
  230. /// @param {ID} nodeID
  231. /// @param {String} eventName
  232. /// @param {ID} eventContextID
  233. ///
  234. /// @returns {}
  235. this.flushedEventListeners = [ /* nodeID, eventName, eventContextID */ ]
  236. /// Description.
  237. ///
  238. /// @function
  239. ///
  240. /// @param {ID} nodeID
  241. /// @param {String} eventName
  242. /// @param {String[]} eventParameters
  243. ///
  244. /// @returns {}
  245. this.firedEvent = [ /* nodeID, eventName, eventParameters */ ]
  246. /// Description.
  247. ///
  248. /// @function
  249. ///
  250. /// @param {ID} nodeID
  251. /// @param {String} scriptText
  252. /// @param {String} scriptType
  253. ///
  254. /// @returns {}
  255. this.executed = [ /* nodeID, scriptText, scriptType */ ]
  256. /// Time has changed, probably by about the same amount as last time.
  257. ///
  258. /// `ticked` notifications are sent periodically as time moves forward. They are sent at
  259. /// roughly consistent intervals in real time while the application is running. However,
  260. /// application processing delays and network jitter will affect the specific interval.
  261. ///
  262. /// Don't rely on `ticked` notifications to arrive at any particular rate. `ticked` is
  263. /// currently derived from reflector idle messages. Future versions of the reflector may
  264. /// vary the idle message interval based on network conditions and the application state.
  265. ///
  266. /// Use {@link external:Window#requestAnimationFrame window.requestAnimationFrame} or
  267. /// {@link external:WindowTimers#setInterval window.setInterval} for real-time
  268. /// notifications. To receive notifications following application state changes, but not
  269. /// necessarily periodically, listen for {@link module:vwf/api/view.tocked view.tocked}.
  270. ///
  271. /// @function
  272. ///
  273. /// @param {Number} time
  274. ///
  275. /// @returns {}
  276. this.ticked = [ /* time */ ]
  277. /// Time has changed.
  278. ///
  279. /// Unlike {@link module:vwf/api/view.ticked view.ticked}, `tocked` notifications are sent
  280. /// each time that time moves forward. Time changes may occur when previously scheduled
  281. /// actions are executed or as regular idle progress. Since the application state only
  282. /// changes when simulation time changes, `tocked` notifications may be used as an
  283. /// application-wide change notification.
  284. ///
  285. /// @function
  286. ///
  287. /// @param {Number} time
  288. ///
  289. /// @returns {}
  290. this.tocked = [ /* time */ ]
  291. /// Description.
  292. ///
  293. /// @callback module:vwf/api/view~readyCallback
  294. ///
  295. /// @param {Boolean} ready
  296. }
  297. }
  298. export {
  299. ViewApi
  300. }